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

Fix 401 unauthorized error #85

Open nanishin opened 2 years ago

nanishin commented 2 years ago

Fix 401 unauthorized error by missed write permission

$ python3 delete_tweet.py Traceback (most recent call last): File "delete_tweet.py", line 67, in raise Exception( Exception: Request returned an error: 401 { "title": "Unauthorized", "type": "about:blank", "status": 401, "detail": "Unauthorized" }

github-actions[bot] commented 2 years ago

CLA Assistant Lite bot All Contributors have signed the CLA. If the commit check is not passing, a maintainer must go the Checks tab of this PR and rerun the GitHub Action.

nanishin commented 2 years ago

Hello there,

FYI, It's my second day to use twitter python sample codes. When I checked delete_tweet.py operation, it gave me "401 Unauthorized Error" continuously. I found the difference when compared with create_tweet.py. It comes from missed write permission. So I added parameters like create_tweet.py and it worked like a charm. :D Please check the commit and apply it if there's no other issue.

Regards,

nanishin commented 2 years ago

I have read the CLA Document and I hereby sign the CLA

nanishin commented 2 years ago

recheck

jiantaolmc commented 1 year ago

raise Exception( Exception: Request returned an error: 401 { "title": "Unauthorized", "type": "about:blank", "status": 401, "detail": "Unauthorized" }