Support for Twitter API v2
See original GitHub issueNow that the new Twitter API has been launched, support for it needs to be added in Tweepy.
This is planned to be part of v4.0.
v3.10 will be released first, as the last version to support Python 2.7 (and probably Python 3.5).
My goal is to get v3.10 out before the end of the year and then work on dropping support for Python 2.
v3.10 has been released now, and support for Python 2.7 and 3.5 has been dropped.
Afterwards, This will be the next priority, along with support for asyncio.
Initial support for Twitter API v2 has been added with Tweepy v4.0. Support for additional endpoints and features have been added with Tweepy v4.1, v4.2, v4.3, v4.4, v4.5, and v4.6.
Support for new endpoints and features will be tracked in new individual issues.
Endpoints to support
Tweets
Filtered stream
- GET /2/tweets/search/stream (https://github.com/tweepy/tweepy/commit/86244c1a82a1852d04f3695b03201363f5d5eafd)
- GET /2/tweets/search/stream/rules (https://github.com/tweepy/tweepy/commit/86244c1a82a1852d04f3695b03201363f5d5eafd)
- POST /2/tweets/search/stream/rules (https://github.com/tweepy/tweepy/commit/86244c1a82a1852d04f3695b03201363f5d5eafd)
Hide replies
- PUT /2/tweets/:id/hidden (#1535)
Likes (lookup + manage)
- DELETE /2/users/:id/likes/:tweet_id (https://github.com/tweepy/tweepy/commit/5beaa24e4c39b9c6777c87dd7e0eeed9a9ee8355)
- GET /2/tweets/:id/liking_users (https://github.com/tweepy/tweepy/commit/a32e6cea08d170e618d46eabc82d673074555c3d)
- GET /2/users/:id/liked_tweets (https://github.com/tweepy/tweepy/commit/a32e6cea08d170e618d46eabc82d673074555c3d)
- POST /2/users/:id/likes (https://github.com/tweepy/tweepy/commit/5beaa24e4c39b9c6777c87dd7e0eeed9a9ee8355)
Manage Tweets
- DELETE /2/tweets/:id (https://github.com/tweepy/tweepy/commit/7884e3a7253d9a821ff46160ec0d3811f299327f)
- POST /2/tweets (https://github.com/tweepy/tweepy/commit/7884e3a7253d9a821ff46160ec0d3811f299327f)
Retweets
- DELETE /2/users/:id/retweets/:source_tweet_id (https://github.com/tweepy/tweepy/commit/b4985e04acb87b791e4d0d3f45bd57e5410e7d48)
- GET /2/tweets/:id/retweeted_by (https://github.com/tweepy/tweepy/commit/b4985e04acb87b791e4d0d3f45bd57e5410e7d48)
- POST /2/users/:id/retweets (https://github.com/tweepy/tweepy/commit/b4985e04acb87b791e4d0d3f45bd57e5410e7d48)
Search Tweets (full-archive + recent)
- GET /2/tweets/search/all (#1535)
- GET /2/tweets/search/recent (#1535)
Timelines
- GET /2/users/:id/mentions (#1535)
- GET /2/users/:id/tweets (#1535)
GET /2/users/by/username/:username/mentionsGET /2/users/by/username/:username/tweets
Tweet counts
- GET /2/tweets/counts/all (https://github.com/tweepy/tweepy/commit/49156cb9f1d74d709480b8d746b01e755f5c312b)
- GET /2/tweets/counts/recent (https://github.com/tweepy/tweepy/commit/49156cb9f1d74d709480b8d746b01e755f5c312b)
Tweet lookup
- GET /2/tweets (#1535)
- GET /2/tweets/:id (#1535)
Volume streams
- GET /2/tweets/sample/stream (https://github.com/tweepy/tweepy/commit/86244c1a82a1852d04f3695b03201363f5d5eafd)
Users
Blocks (lookup + manage)
- DELETE /2/users/:source_user_id/blocking/:target_user_id (https://github.com/tweepy/tweepy/commit/18e0b1a37c36e270ccc9c50cb1343f03637f70e0)
- GET /2/users/:id/blocking (https://github.com/tweepy/tweepy/commit/a32e6cea08d170e618d46eabc82d673074555c3d)
- POST /2/users/:id/blocking (https://github.com/tweepy/tweepy/commit/18e0b1a37c36e270ccc9c50cb1343f03637f70e0)
Follows (lookup + manage)
- DELETE /2/users/:source_user_id/following/:target_user_id (#1535)
- GET /2/users/:id/followers (#1535)
- GET /2/users/:id/following (#1535)
GET /2/users/by/username/:username/followersGET /2/users/by/username/:username/following- POST /2/users/:id/following (#1535)
Mutes (lookup + manage)
- DELETE /2/users/:source_user_id/muting/:target_user_id (https://github.com/tweepy/tweepy/commit/b20b236c4ca10a5376ea2f612a1ad324f21d7072)
- GET /2/users/:id/muting (https://github.com/tweepy/tweepy/commit/00cdab8a86b98c6b02636fd511700fc73653e006)
- POST /2/users/:id/muting (https://github.com/tweepy/tweepy/commit/b20b236c4ca10a5376ea2f612a1ad324f21d7072)
User lookup
- GET /2/users (#1535)
- GET /2/users/:id (#1535)
- GET /2/users/by (#1535)
- GET /2/users/by/username/:username (#1535)
- GET /2/users/me (https://github.com/tweepy/tweepy/commit/c49cbdfcbda48295591d731446cd03b2eb2332ae, https://github.com/tweepy/tweepy/commit/62b5b586e75a850427eabdf31448d73a9e564f66)
Spaces
Search Spaces
- GET /2/spaces/search (https://github.com/tweepy/tweepy/commit/5c688922cf0f8e89d401ea5108b06aaa8c12d71b)
Spaces lookup (buyers, Tweets)
- GET /2/spaces (https://github.com/tweepy/tweepy/commit/5c688922cf0f8e89d401ea5108b06aaa8c12d71b)
- GET /2/spaces/:id (https://github.com/tweepy/tweepy/commit/5c688922cf0f8e89d401ea5108b06aaa8c12d71b)
- GET /2/spaces/:id/buyers (https://github.com/tweepy/tweepy/commit/8bf58ca5754f72292d1d86367a02778af7a44f20)
- GET /2/spaces/:id/tweets (https://github.com/tweepy/tweepy/commit/c8d5d9ad2c2b3c6b58b987286726cad467ce888f)
- GET /2/spaces/by/creator_ids (https://github.com/tweepy/tweepy/commit/5c688922cf0f8e89d401ea5108b06aaa8c12d71b)
Lists (lookup + manage)
List Tweets lookup
- GET /2/lists/:id/tweets (https://github.com/tweepy/tweepy/commit/0aa2366a875464756507abf42709a3db676f4cee)
List follows
- DELETE /2/users/:id/followed_lists/:list_id (https://github.com/tweepy/tweepy/commit/b1342bfc998bee334437f2b7a8d2aef4df7c3838)
- GET /2/lists/:id/followers (https://github.com/tweepy/tweepy/commit/0aa2366a875464756507abf42709a3db676f4cee)
- GET /2/users/:id/followed_lists (https://github.com/tweepy/tweepy/commit/0aa2366a875464756507abf42709a3db676f4cee)
- POST /2/users/:id/followed_lists (https://github.com/tweepy/tweepy/commit/b1342bfc998bee334437f2b7a8d2aef4df7c3838)
List lookup
- GET /2/lists/:id (https://github.com/tweepy/tweepy/commit/0aa2366a875464756507abf42709a3db676f4cee)
- GET /2/users/:id/owned_lists (https://github.com/tweepy/tweepy/commit/0aa2366a875464756507abf42709a3db676f4cee)
List members
- DELETE /2/lists/:id/members/:user_id (https://github.com/tweepy/tweepy/commit/b1342bfc998bee334437f2b7a8d2aef4df7c3838)
- GET /2/lists/:id/members (https://github.com/tweepy/tweepy/commit/0aa2366a875464756507abf42709a3db676f4cee)
- GET /2/users/:id/list_memberships (https://github.com/tweepy/tweepy/commit/0aa2366a875464756507abf42709a3db676f4cee)
- POST /2/lists/:id/members (https://github.com/tweepy/tweepy/commit/b1342bfc998bee334437f2b7a8d2aef4df7c3838)
Manage Lists
- DELETE /2/lists/:id (https://github.com/tweepy/tweepy/commit/b1342bfc998bee334437f2b7a8d2aef4df7c3838)
- PUT /2/lists/:id (https://github.com/tweepy/tweepy/commit/b1342bfc998bee334437f2b7a8d2aef4df7c3838)
- POST /2/lists (https://github.com/tweepy/tweepy/commit/b1342bfc998bee334437f2b7a8d2aef4df7c3838)
Pinned Lists
- DELETE /2/users/:id/pinned_lists/:list_id (https://github.com/tweepy/tweepy/commit/b1342bfc998bee334437f2b7a8d2aef4df7c3838)
- GET /2/users/:id/pinned_lists (https://github.com/tweepy/tweepy/commit/0aa2366a875464756507abf42709a3db676f4cee)
- POST /2/users/:id/pinned_lists (https://github.com/tweepy/tweepy/commit/b1342bfc998bee334437f2b7a8d2aef4df7c3838)
Compliance
Batch Compliance
- GET /2/compliance/jobs (https://github.com/tweepy/tweepy/commit/6ca75e1b69a1085ac43215b30fc8269b91faa790)
- GET /2/compliance/jobs/:id (https://github.com/tweepy/tweepy/commit/6ca75e1b69a1085ac43215b30fc8269b91faa790)
- POST /2/compliance/jobs (https://github.com/tweepy/tweepy/commit/6ca75e1b69a1085ac43215b30fc8269b91faa790)
Addendum
- Media
alt_text
field (https://github.com/tweepy/tweepy/commit/379e99a672537776ac0e160999967b5efce29305) -
state
parameter optional for spaces search endpoint (https://github.com/tweepy/tweepy/commit/e61d5d6f017db7f28871331b515fcfd87666f352) - Space
ended_at
andtopic_ids
fields (https://github.com/tweepy/tweepy/commit/c89a233a96142ce01ecd5e1372c3fdce45c6601f) - OAuth 2.0 Authorization Code Flow with Proof Key for Code Exchange (PKCE) (https://github.com/tweepy/tweepy/commit/2b835073cb193ca6f2849c8cb6ef4322e5b16f24, https://github.com/tweepy/tweepy/commit/8f384294405c6d14507441a5d1a7040d927b3fc2)
- Updates to Retweets lookup and Likes lookup endpoints (https://github.com/tweepy/tweepy/commit/3479e56a0fff02594ab6e77ca8227e65b51b46f7, https://github.com/tweepy/tweepy/commit/bdd6b55d7cb075fc2e4c7cb56a061c552ca106fe)
-
sort_order
parameter for search endpoints (https://github.com/tweepy/tweepy/commit/bd202e5be19670116ebe98329d388b4821d5f3eb, https://github.com/tweepy/tweepy/commit/8b47170e7c20127add3e67190890d2a4cef92266) - Space
subscriber_count
field (https://github.com/tweepy/tweepy/commit/1ffc8cda6d2b9670b86610859f21ac05d726eaf9)
Support for Labs (~~https://developer.twitter.com/en/products/labs~~)
COVID-19 stream (#1790)
Additional Resources
https://developer.twitter.com/en/docs/twitter-api/early-access https://developer.twitter.com/en/docs/twitter-api/migrate https://developer.twitter.com/en/products/twitter-api/early-access/guide https://blog.twitter.com/developer/en_us/topics/tools/2020/introducing_new_twitter_api.html https://twittercommunity.com/t/announcing-early-access-to-the-next-generation-of-the-twitter-api/139612
https://blog.twitter.com/developer/en_us/topics/tools/2021/shape-the-future-of-twitter-spaces
https://twittercommunity.com/t/announcing-oauth-2-0-beta/159189
Old Postscript
I’d like to apologize for the delay in responding to @andypiper and others about this in #1345, #1396, and #1423, as well as on Discord. I’ve (I think understandably) fallen behind a bit this year in my plans for Tweepy and in keeping up with issues and Discord messages, but I’m working on catching back up.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:26
- Comments:41 (37 by maintainers)
Top GitHub Comments
Most of the endpoints should now be part of the api-v2 branch / PR #1535. Once that PR is ready, I’ll take it out of its draft state and leave it open for a few weeks for people to test and review. Afterwards, it’ll be merged into the master branch. As for v4.0 itself, there’s other features (https://github.com/tweepy/tweepy/milestone/11) that I want to include in it before it’s released.
v4.6.0 (#1824) has been released with support for streaming, the new Retweets lookup and Likes lookup endpoint parameters, the new
sort_order
parameter for search endpoints, and the new Tweets shared in a Space endpoint and RSVP count field for Spaces 🎉With this release, Tweepy now fully supports all of Twitter API v2, almost exactly a year after the initial implementation for Twitter API v2 support was pushed. New individual issues will be created for any future new Twitter API v2 endpoints and features.
(The COVID-19 stream is the only remaining active portion of Labs and support for it is being tracked in #1790.)