From 935ea8c622327141fbdc715a99435567fab0fa6b Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 26 Aug 2023 12:11:00 -0500 Subject: [PATCH] Deprecate API methods using now deprecated v1.1 endpoints https://twittercommunity.com/t/x-api-v2-migration/203391 --- tweepy/api.py | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 1 deletion(-) diff --git a/tweepy/api.py b/tweepy/api.py index 22cacaf77..37caf07af 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -470,6 +470,12 @@ def lookup_statuses(self, id, **kwargs): Returns full Tweet objects for up to 100 Tweets per request, specified by the ``id`` parameter. + .. deprecated:: 4.15.0 + `The Twitter API v1.1 statuses/lookup endpoint that this method + uses has been deprecated and has a retirement date of November 20, + 2023.`_ The Twitter API v2 replacement is + :meth:`Client.get_tweets`. + .. versionchanged:: 4.0 Renamed from ``API.statuses_lookup`` @@ -496,6 +502,10 @@ def lookup_statuses(self, id, **kwargs): References ---------- https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/get-statuses-lookup + + .. _The Twitter API v1.1 statuses/lookup endpoint that this method uses + has been deprecated and has a retirement date of November 20, + 2023.: https://twittercommunity.com/t/x-api-v2-migration/203391 """ return self.request( 'GET', 'statuses/lookup', endpoint_parameters=( @@ -710,6 +720,11 @@ def get_status(self, id, **kwargs): Returns a single status specified by the ID parameter. + .. deprecated:: 4.15.0 + `The Twitter API v1.1 statuses/show endpoint that this method uses + has been deprecated and has a retirement date of November 20, + 2023.`_ The Twitter API v2 replacement is :meth:`Client.get_tweet`. + Parameters ---------- id: @@ -735,6 +750,10 @@ def get_status(self, id, **kwargs): References ---------- https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/get-statuses-show-id + + .. _The Twitter API v1.1 statuses/show endpoint that this method uses + has been deprecated and has a retirement date of November 20, + 2023.: https://twittercommunity.com/t/x-api-v2-migration/203391 """ return self.request( 'GET', 'statuses/show', endpoint_parameters=( @@ -806,6 +825,12 @@ def destroy_status(self, id, **kwargs): Destroy the status specified by the ``id`` parameter. The authenticated user must be the author of the status to destroy. + .. deprecated:: 4.15.0 + `The Twitter API v1.1 statuses/destroy endpoint that this method + uses has been deprecated and has a retirement date of November 20, + 2023.`_ The Twitter API v2 replacement is + :meth:`Client.delete_tweet`. + Parameters ---------- id @@ -820,6 +845,10 @@ def destroy_status(self, id, **kwargs): References ---------- https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-destroy-id + + .. _The Twitter API v1.1 statuses/destroy endpoint that this method + uses has been deprecated and has a retirement date of November 20, + 2023.: https://twittercommunity.com/t/x-api-v2-migration/203391 """ return self.request( 'POST', f'statuses/destroy/{id}', endpoint_parameters=( @@ -833,6 +862,11 @@ def retweet(self, id, **kwargs): Retweets a Tweet. Requires the ID of the Tweet you are retweeting. + .. deprecated:: 4.15.0 + `The Twitter API v1.1 statuses/retweet endpoint that this method + uses has been deprecated and has a retirement date of November 20, + 2023.`_ The Twitter API v2 replacement is :meth:`Client.retweet`. + Parameters ---------- id @@ -847,6 +881,10 @@ def retweet(self, id, **kwargs): References ---------- https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-retweet-id + + .. _The Twitter API v1.1 statuses/retweet endpoint that this method + uses has been deprecated and has a retirement date of November 20, + 2023.: https://twittercommunity.com/t/x-api-v2-migration/203391 """ return self.request( 'POST', f'statuses/retweet/{id}', endpoint_parameters=( @@ -861,6 +899,12 @@ def unretweet(self, id, **kwargs): Untweets a retweeted status. Requires the ID of the retweet to unretweet. + .. deprecated:: 4.15.0 + `The Twitter API v1.1 statuses/unretweet endpoint that this method + uses has been deprecated and has a retirement date of November 20, + 2023.`_ The Twitter API v2 replacement is + :meth:`Client.unretweet`. + Parameters ---------- id @@ -875,6 +919,10 @@ def unretweet(self, id, **kwargs): References ---------- https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-unretweet-id + + .. _The Twitter API v1.1 statuses/unretweet endpoint that this method + uses has been deprecated and has a retirement date of November 20, + 2023.: https://twittercommunity.com/t/x-api-v2-migration/203391 """ return self.request( 'POST', f'statuses/unretweet/{id}', endpoint_parameters=( @@ -904,6 +952,12 @@ def update_status(self, status, **kwargs): the user reaches the current allowed limit this method will return an HTTP 403 error. + .. deprecated:: 4.15.0 + `The Twitter API v1.1 statuses/update endpoint that this method + uses has been deprecated and has a retirement date of November 20, + 2023.`_ The Twitter API v2 replacement is + :meth:`Client.create_tweet`. + Parameters ---------- status @@ -972,6 +1026,10 @@ def update_status(self, status, **kwargs): References ---------- https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-update + + .. _The Twitter API v1.1 statuses/update endpoint that this method + uses has been deprecated and has a retirement date of November 20, + 2023.: https://twittercommunity.com/t/x-api-v2-migration/203391 """ if 'media_ids' in kwargs: kwargs['media_ids'] = list_to_csv(kwargs['media_ids']) @@ -998,7 +1056,10 @@ def update_status_with_media(self, status, filename, *, file=None, too long will be silently ignored. .. deprecated:: 3.7.0 - Use :meth:`media_upload` instead. + `The Twitter API v1.1 statuses/update_with_media endpoint that this + method uses has been deprecated and has a retirement date of + November 20, 2023.`_ :meth:`API.media_upload` and + :meth:`Client.create_tweet` can be used instead. .. versionchanged:: 4.0 Renamed from ``API.update_with_media`` @@ -1034,6 +1095,11 @@ def update_status_with_media(self, status, filename, *, file=None, References ---------- https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-update_with_media + + .. _The Twitter API v1.1 statuses/update_with_media endpoint that this + method uses has been deprecated and has a retirement date of + November 20, 2023.: + https://twittercommunity.com/t/x-api-v2-migration/203391 """ with contextlib.ExitStack() as stack: if file is not None: @@ -1082,6 +1148,12 @@ def search_tweets(self, q, **kwargs): authenticating user) are not currently supported on this endpoint. [#]_\ [#]_ + .. deprecated:: 4.15.0 + `The Twitter API v1.1 search/tweets endpoint that this method uses + has been deprecated and has a retirement date of September 20, + 2023.`_ The Twitter API v2 replacement is + :meth:`Client.search_recent_tweets`. + .. versionchanged:: 4.0 Renamed from ``API.search`` @@ -1143,6 +1215,9 @@ def search_tweets(self, q, **kwargs): .. _Twitter's documentation on the standard search API: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/overview + .. _The Twitter API v1.1 search/tweets endpoint that this method uses + has been deprecated and has a retirement date of September 20, + 2023.: https://twittercommunity.com/t/x-api-v2-migration/203391 """ return self.request( 'GET', 'search/tweets', endpoint_parameters=( @@ -2295,6 +2370,11 @@ def search_users(self, q, **kwargs): returned by using this API (about being listed in the People Search). It is only possible to retrieve the first 1000 matches from this API. + .. deprecated:: 4.15.0 + `The Twitter API v1.1 users/search endpoint that this method uses + has been deprecated and has a retirement date of September 20, + 2023.`_ + Parameters ---------- q @@ -2313,6 +2393,10 @@ def search_users(self, q, **kwargs): References ---------- https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-users-search + + .. _The Twitter API v1.1 users/search endpoint that this method uses + has been deprecated and has a retirement date of September 20, + 2023.: https://twittercommunity.com/t/x-api-v2-migration/203391 """ return self.request( 'GET', 'users/search', endpoint_parameters=( @@ -3850,6 +3934,10 @@ def search_geo(self, **kwargs): of other parameters. For instance, ``lat`` is required if ``long`` is provided, and vice-versa. + .. deprecated:: 4.15.0 + `The Twitter API v1.1 geo/search endpoint that this method uses has + been deprecated and has a retirement date of September 20, 2023.`_ + .. versionchanged:: 4.0 Renamed from ``API.geo_search`` @@ -3894,6 +3982,10 @@ def search_geo(self, **kwargs): References ---------- https://developer.twitter.com/en/docs/twitter-api/v1/geo/places-near-location/api-reference/get-geo-search + + .. _The Twitter API v1.1 geo/search endpoint that this method uses has + been deprecated and has a retirement date of September 20, 2023.: + https://twittercommunity.com/t/x-api-v2-migration/203391 """ return self.request( 'GET', 'geo/search', endpoint_parameters=(