'About Improving my code about tweepy stream
Since recently, we've been using tweepy's Stream feature to create code in python that follows people who tweet and retweet tweets that contain specific words. As a result, the code is working, but
stream encountered http error: 406
I get the above error and it is not working.
I searched variously on the net, but i could not found any ideas. If you know any solution, please let me know.
My current code is something like this:
import tweepy
from tweepy import Stream
CK = '*****'
CS = '*****'
AT = '*****'
AS = '*****'
auth = tweepy.OAuthHandler(CK, CS)
auth.set_access_token(AT, AS)
api = tweepy.API(auth)
word = "python"
class MyListener(Stream):
def on_status(self, status):
if 'RT @' not in status.text[0:4]:
if 'http' not in status.text:
api.retweet(id=status.id)
api.create_friendship(id=user_id)
twitter_stream = MyListener(CK,CS,AT,AS)
twitter_stream.filter(track=[word])
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
