Skip to content

Commit

Permalink
Adjust API version for the Streaming API endpoints.
Browse files Browse the repository at this point in the history
Twitter has harmonised the version numbers of the Streaming API
endpoints so that they are all numbered 1.1. All previous endpoints have
been deprecated and will stop working Real Soon Now™.

This partially addresses #15.
  • Loading branch information
ralphm committed May 27, 2013
1 parent 5fab264 commit 8524750
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
4 changes: 2 additions & 2 deletions twittytwister/test/test_twitter.py
Expand Up @@ -39,7 +39,7 @@ def test_user(self):
self.feed.user(None)
self.assertEqual(1, len(self.calls))
url, delegate, args = self.calls[-1]
self.assertEqual('https://userstream.twitter.com/2/user.json', url)
self.assertEqual('https://userstream.twitter.com/1.1/user.json', url)
self.assertIdentical(None, delegate)
self.assertIdentical(None, args)

Expand All @@ -62,7 +62,7 @@ def test_site(self):
self.feed.site(None, {'follow': '6253282'})
self.assertEqual(1, len(self.calls))
url, delegate, args = self.calls[-1]
self.assertEqual('https://sitestream.twitter.com/2b/site.json', url)
self.assertEqual('https://sitestream.twitter.com/1.1/site.json', url)
self.assertIdentical(None, delegate)
self.assertEqual({'follow': '6253282'}, args)

Expand Down
35 changes: 20 additions & 15 deletions twittytwister/twitter.py
Expand Up @@ -616,9 +616,10 @@ def sample(self, delegate, args=None):
The actual access level determines the portion of the firehose.
"""
return self._rtfeed('https://stream.twitter.com/1/statuses/sample.json',
delegate,
args)
return self._rtfeed(
'https://stream.twitter.com/1.1/statuses/sample.json',
delegate,
args)


def spritzer(self, delegate, args=None):
Expand All @@ -645,18 +646,20 @@ def firehose(self, delegate, args=None):
"""
Returns all public statuses.
"""
return self._rtfeed('https://stream.twitter.com/1/statuses/firehose.json',
delegate,
args)
return self._rtfeed(
'https://stream.twitter.com/1.1/statuses/firehose.json',
delegate,
args)


def filter(self, delegate, args=None):
"""
Returns public statuses that match one or more filter predicates.
"""
return self._rtfeed('https://stream.twitter.com/1/statuses/filter.json',
delegate,
args)
return self._rtfeed(
'https://stream.twitter.com/1.1/statuses/filter.json',
delegate,
args)


def follow(self, delegate, follow):
Expand Down Expand Up @@ -716,9 +719,10 @@ def user(self, delegate, args=None):
also track certain keywords, follow additional accounts or filter by
location.
"""
return self._rtfeed('https://userstream.twitter.com/2/user.json',
delegate,
args)
return self._rtfeed(
'https://userstream.twitter.com/1.1/user.json',
delegate,
args)


def site(self, delegate, args):
Expand All @@ -734,9 +738,10 @@ def site(self, delegate, args):
accounts the users follow and/or all replies to accounts the users
follow.
"""
return self._rtfeed('https://sitestream.twitter.com/2b/site.json',
delegate,
args)
return self._rtfeed(
'https://sitestream.twitter.com/1.1/site.json',
delegate,
args)



Expand Down

0 comments on commit 8524750

Please sign in to comment.