python-twitter-tools / twitter

Python Twitter API
http://mike.verdone.ca/twitter/
MIT License
3.17k stars 710 forks source link

Module no longer works with Twitter free tier #463

Open endlisnis opened 1 year ago

endlisnis commented 1 year ago

Starting today, I get this message while trying to use this library to post anything on Twitter:

twitter.api.TwitterHTTPError: Twitter sent status 403 for URL: 1.1/statuses/update.json using parameters: (media_ids=...&oauth_consumer_key=...&oauth_nonce=...&oauth_signature_method=HMAC-SHA1&oauth_timestamp=...&oauth_token=...&oauth_version=1.0&status=Today%20is%20the%20muggiest%20day%20on%20record%20in%20%23Gander%3A%2040.5.%20%23NLWx&oauth_signature=...) details: {'errors': [{'message': 'You currently have access to a subset of Twitter API v2 endpoints and limited v1.1 endpoints (e.g. media post, oauth) only. If you need access to this endpoint, you may need a different access level. You can learn more here: https://developer.twitter.com/en/portal/product', 'code': 453}]}

boogheta commented 1 year ago

This is the typical response from API v1.1 keys that are disabled by Twitter following Musk's announces that were supposed to happen last march or april. Lots of keys remained functional up until now but it seems they are closing all the last remaining ones those last few days.

image

edit: all v2 keys have been killed earlier than that, so the only remaining options are now the free v2 access which provides nearly no rights or the paying one which has a crazy prohibitive cost that will probably kill the API for most users : image

This is the end, my friend.
endlisnis commented 1 year ago

Thanks @boogheta for your reply, but I'm not sure what you are saying.

Yes, they changed all of their API access tiers earlier in the year, but I already converted my app to their new "Free" tier. The free tier worked with the v1.1 endpoints up until yesterday, and now they stopped working. I believe if this twitter module started using their v2 endpoints, it would continue working in their free tier.

endlisnis commented 1 year ago

Even when I completely recreate my Twitter App, it gives me different login info, and I'm forced to use OAuth2; but even then I still get errors about trying to use v1.1 endpoints.

RouxRC commented 1 year ago

I believe they kept for a long time all routes of v1.1 available but finally closed down it all yesterday. But indeed some v1.1 and v2 routes are supposed to be available with the free tiers, you can try it out.

You can use the v2 endpoints by installing the 2.0-a2 release (pip install twitter==2.0a2), see the doc in this branch https://github.com/python-twitter-tools/twitter/tree/api_v2#--instantiating