'401 error code being returned when trying to stream live Tweets from a specific account with Tweepy
Anyone have any idea what could be causing the error? All my keys and tokens should be correct. I made sure to double check them. I followed the steps on how to set up the stream pretty arcuately I thought.
import time
import tweepy
import praw
#Variables that contains the credentials to access Twitter API and REDDIT
USERNAME = ""
PASSWORD = "!"
CLIENT_ID = ''
CLIENT_SECRET = ''
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, consumer_key)
api = tweepy.API(auth, wait_on_rate_limit=True)
class MyStreamListener(tweepy.Stream):
def on_status(self, status):
print("ID: {}".format(status.id))
print(status.full_text)
def streamtweets():
myStreamListener = MyStreamListener(consumer_key, consumer_secret,access_token, consumer_key)
myStream = tweepy.Stream(consumer_key, consumer_secret,access_token, consumer_key)
myStream.filter(follow = [''])
streamtweets()
Solution 1:[1]
You're passing your consumer_key
as the access token secret.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Harmon758 |