I'm unsure what is going wrong in here. The following code was working until 2 days ago. I'm using tweepy
version number 3.6.0
on python3
in jupyter notebook
. Now, when I execute the code given below, I keep getting the error, `TweepError: [{'code': 215, 'message': 'Bad Authentication data.'}]. What am I doing wrong?
import tweepy
# Read the twitter credential file
creds_file="twitter_creds.txt"
with open(creds_file,'r') as f:
mylist=[line.rstrip('\n') for line in f]
ckey = mylist[0] # The first element of the list
csecret = mylist[1] # The second element of the list
#print("ckey: "+consumer_key, "\ncs: "+consumer_secret)
atoken= mylist[2] # The third element of the list
asecret = mylist[3] # The last element of the list
# OAuth process, using the keys and tokens
auth = tweepy.OAuthHandler(ckey, csecret)
auth.set_access_token(atoken, asecret)
# Creation of the actual interface, using authentication
api = tweepy.API(auth)
# collect tweets on #MRT
for tweet in tweepy.Cursor(api.search,q="MRT",count=100,
lang="en",rpp=100,
since="2017-04-03").items():
print (tweet.created_at, tweet.text)