Deprecate Stream.sample
authorHarmon <Harmon758@gmail.com>
Sat, 30 Apr 2022 11:23:10 +0000 (06:23 -0500)
committerHarmon <Harmon758@gmail.com>
Sat, 30 Apr 2022 11:23:10 +0000 (06:23 -0500)
https://twittercommunity.com/t/deprecation-announcement-removing-compliance-messages-from-statuses-filter-and-retiring-statuses-sample-from-the-twitter-api-v1-1/170500

tweepy/streaming.py

index b4563cf8435cfde86a2b340166ca8eaf35dcb587..e9cb00afc16068c7de4037c91e0115aee9f753b6 100644 (file)
@@ -345,6 +345,11 @@ class Stream(BaseStream):
     def sample(self, *, languages=None, stall_warnings=False, threaded=False):
         """Sample realtime Tweets
 
+        .. deprecated:: 4.9
+            `The Twitter API v1.1 endpoint this method uses is now deprecated
+            and will be retired on October 29, 2022.`_ Twitter API v2 can be
+            used instead with :meth:`StreamingClient.sample`.
+
         Parameters
         ----------
         languages : list[str] | None
@@ -370,6 +375,8 @@ class Stream(BaseStream):
 
         .. _BCP 47: https://tools.ietf.org/html/bcp47
         .. _advanced search: https://twitter.com/search-advanced
+        .. _The Twitter API v1.1 endpoint this method uses is now deprecated
+            and will be retired on October 29, 2022.: https://twittercommunity.com/t/deprecation-announcement-removing-compliance-messages-from-statuses-filter-and-retiring-statuses-sample-from-the-twitter-api-v1-1/170500
         """
         if self.running:
             raise TweepyException("Stream is already connected")