Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 Forbidden on basic tier subscription while streaming with tweepy while cURL on REST endpoints work fine #2175

Open
sumitdhungana14 opened this issue Feb 29, 2024 · 1 comment

Comments

@sumitdhungana14
Copy link

I’m using tweepy to stream tweets and I’ve subscribed to basic tier program:
The code looks something like the following, I read in a couple of articles and tutorials that tweepy works with basic tier but I’m getting the error below on running the code.

auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_secret)
api = API(auth)

rdd_queue = []

class CustomStreamListener(tweepy.StreamingClient):
def init(self, bearer_token, rdd_queue):
super().init(bearer_token)
self.rdd_queue = rdd_queue

def on_tweet(self, tweet):
print(tweet.text)
self.rdd_queue.append(tweet.text)
listener = CustomStreamListener(bearer_token=bearer_token, rdd_queue=rdd_queue)

listener.filter(expansions=‘author_id’, tweet_fields=‘created_at’)

Error:
Stream encountered HTTP error: 403
HTTP error response text: {“client_id”:“XXXXXXX”,“detail”:“When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project. You can create a project via the developer portal.”,“registration_url”:“XXX/projects/overview”,“title”:“Client Forbidden”,“required_enrollment”:“Appropriate Level of API Access”,“reason”:“client-not-enrolled”,“type”:“XXX/2/problems/client-forbidden”}

but i’ve already created an app within a project, could someone tell me what’s going on? or if anything is wrong in the code?

@TaufeeqNoamaan
Copy link

Hi @sumitdhungana14

Apparently, streaming is only available in the enterprise developer subscription!

Nothing wrong with your code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants