Remove Stream.sitestream and Stream.userstream
authorHarmon <Harmon758@gmail.com>
Mon, 28 Dec 2020 13:09:49 +0000 (07:09 -0600)
committerHarmon <Harmon758@gmail.com>
Mon, 28 Dec 2020 13:09:49 +0000 (07:09 -0600)
In favor of #1075

docs/streaming_how_to.rst
tests/test_streaming.py
tweepy/streaming.py

index 3ab2b4f0b546200eff9da1090660462a7d9d9ffb..62cf5af20b44a5052ef60e45e9c36d0ea76b2d67 100644 (file)
@@ -73,7 +73,7 @@ Once we have an api and a status listener we can create our stream object.::
 Step 3: Starting a Stream
 =========================
 A number of twitter streams are available through Tweepy. Most cases 
-will use filter, the user_stream, or the sitestream
+will use filter. 
 For more information on the capabilities and limitations of the different
 streams see `Twitter Streaming API Documentation`_.
 
index c64b516c3452cba1e46d0d61ac606e06427bb27e..8665dc0d95ce5342dceca4571da0743f9446518b 100644 (file)
@@ -51,31 +51,6 @@ class TweepyStreamTests(unittest.TestCase):
     def on_connect(self):
         API(self.auth).update_status(mock_tweet())
 
-    def test_userstream(self):
-        # Generate random tweet which should show up in the stream.
-
-        self.listener.connect_cb = self.on_connect
-        self.listener.status_stop_count = 1
-        self.stream.userstream()
-        self.assertEqual(self.listener.status_count, 1)
-
-    @skip("Sitestream only available to whitelisted accounts.")
-    def test_sitestream(self):
-        self.listener.connect_cb = self.on_connect
-        self.listener.status_stop_count = 1
-        self.stream.sitestream(follow=[self.auth.get_username()])
-        self.assertEqual(self.listener.status_count, 1)
-
-    def test_userstream_with_params(self):
-        # Generate random tweet which should show up in the stream.
-        def on_connect():
-            API(self.auth).update_status(mock_tweet())
-
-        self.listener.connect_cb = on_connect
-        self.listener.status_stop_count = 1
-        self.stream.userstream(_with='user', replies='all', stall_warnings=True)
-        self.assertEqual(self.listener.status_count, 1)
-
     def test_sample(self):
         self.listener.status_stop_count = 10
         self.stream.sample()
index 1fdae6b8c0ba8927540bd64305b17055236c6f12..898a7c1e834d12407a372d7f8d22ff419b0fef03 100644 (file)
@@ -388,35 +388,6 @@ class Stream:
         """ Called when the response has been closed by Twitter """
         pass
 
-    def userstream(self,
-                   stall_warnings=False,
-                   _with=None,
-                   replies=None,
-                   track=None,
-                   locations=None,
-                   is_async=False,
-                   encoding='utf8'):
-        self.session.params = {'delimited': 'length'}
-        if self.running:
-            raise TweepError('Stream object already connected!')
-        self.url = '/%s/user.json' % STREAM_VERSION
-        self.host = 'userstream.twitter.com'
-        if stall_warnings:
-            self.session.params['stall_warnings'] = stall_warnings
-        if _with:
-            self.session.params['with'] = _with
-        if replies:
-            self.session.params['replies'] = replies
-        if locations and len(locations) > 0:
-            if len(locations) % 4 != 0:
-                raise TweepError("Wrong number of locations points, "
-                                 "it has to be a multiple of 4")
-            self.session.params['locations'] = ','.join(['%.2f' % l for l in locations])
-        if track:
-            self.session.params['track'] = ','.join(track).encode(encoding)
-
-        self._start(is_async)
-
     def sample(self, is_async=False, languages=None, stall_warnings=False):
         self.session.params = {'delimited': 'length'}
         if self.running:
@@ -453,22 +424,6 @@ class Stream:
         self.session.params = {'delimited': 'length'}
         self._start(is_async)
 
-    def sitestream(self, follow, stall_warnings=False,
-                   with_='user', replies=False, is_async=False):
-        self.body = {}
-        if self.running:
-            raise TweepError('Stream object already connected!')
-        self.url = '/%s/site.json' % STREAM_VERSION
-        self.body['follow'] = ','.join(map(str, follow))
-        self.body['delimited'] = 'length'
-        if stall_warnings:
-            self.body['stall_warnings'] = stall_warnings
-        if with_:
-            self.body['with'] = with_
-        if replies:
-            self.body['replies'] = replies
-        self._start(is_async)
-
     def disconnect(self):
         if self.running is False:
             return