xdevplatform / Twitter-API-v2-sample-code

Sample code for the Twitter API v2 endpoints
https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api
Apache License 2.0
2.65k stars 984 forks source link

Cannot get rules (HTTP 401) #72

Closed RPBTwisted closed 2 years ago

RPBTwisted commented 2 years ago

The bug occurs when using the code example for Filtered-Stream. I have set the bearer token through the console as it mentions but I still receive a 401 which would hint towards me not being authorized. I don't know if I have done something wrong regarding the setting of the token, but I did this through the console in VSCode.

The actual error message I received was the one below. I'm not fabulous with Python or the API so I'm a little stuck.

Exception has occurred: Exception Cannot get rules (HTTP 401): {"title":"Unauthorized","detail":"Unauthorized","type":"about:blank","status":401} File "C:\Users\Rhys\OneDrive\Documents\TwitterCrawl.py", line 25, in get_rules raise Exception( File "C:\Users\Rhys\OneDrive\Documents\TwitterCrawl.py", line 89, in main rules = get_rules() File "C:\Users\Rhys\OneDrive\Documents\TwitterCrawl.py", line 96, in <module> main()

bhushan-borole commented 1 year ago

@RPBTwisted Did you find the solution to this?