Merge pull request #245 from ryanmcgrath/dev/add-endpoints
Add endpoints
This commit is contained in:
commit
7a58a15a22
3 changed files with 64 additions and 0 deletions
|
|
@ -12,6 +12,7 @@ History
|
||||||
- When an actual request error happens and a ``RequestException`` is raised, it is caught and a ``TwythonError`` is raised instead for convenience.
|
- When an actual request error happens and a ``RequestException`` is raised, it is caught and a ``TwythonError`` is raised instead for convenience.
|
||||||
- Added "cursor"-like functionality. Endpoints with the attribute ``iter_mode`` will be able to be passed to ``Twython.cursor`` and returned as a generator.
|
- Added "cursor"-like functionality. Endpoints with the attribute ``iter_mode`` will be able to be passed to ``Twython.cursor`` and returned as a generator.
|
||||||
- ``Twython.search_gen`` has been deprecated. Please use ``twitter.cursor(twitter.search, q='your_query')`` instead, where ``twitter`` is your ``Twython`` instance.
|
- ``Twython.search_gen`` has been deprecated. Please use ``twitter.cursor(twitter.search, q='your_query')`` instead, where ``twitter`` is your ``Twython`` instance.
|
||||||
|
- Added methods ``get_list_memberships``, ``get_twitter_configuration``, ``get_supported_languages``, ``get_privacy_policy``, ``get_tos``
|
||||||
|
|
||||||
3.0.0 (2013-06-18)
|
3.0.0 (2013-06-18)
|
||||||
++++++++++++++++++
|
++++++++++++++++++
|
||||||
|
|
|
||||||
|
|
@ -385,6 +385,10 @@ class TwythonAPITestCase(unittest.TestCase):
|
||||||
|
|
||||||
self.api.delete_list(list_id=list_id)
|
self.api.delete_list(list_id=list_id)
|
||||||
|
|
||||||
|
def test_get_list_memberships(self):
|
||||||
|
"""Test list of memberhips the authenticated user succeeds"""
|
||||||
|
self.api.get_list_memberships()
|
||||||
|
|
||||||
def test_get_list_subscribers(self):
|
def test_get_list_subscribers(self):
|
||||||
"""Test list of subscribers of a specific list succeeds"""
|
"""Test list of subscribers of a specific list succeeds"""
|
||||||
self.api.get_list_subscribers(slug=test_list_slug,
|
self.api.get_list_subscribers(slug=test_list_slug,
|
||||||
|
|
@ -478,6 +482,22 @@ class TwythonAPITestCase(unittest.TestCase):
|
||||||
self.api.get_closest_trends(lat='37', long='-122')
|
self.api.get_closest_trends(lat='37', long='-122')
|
||||||
|
|
||||||
# Help
|
# Help
|
||||||
|
def test_get_twitter_configuration(self):
|
||||||
|
"""Test getting Twitter's configuration succeeds"""
|
||||||
|
self.api.get_twitter_configuration()
|
||||||
|
|
||||||
|
def test_get_supported_languages(self):
|
||||||
|
"""Test getting languages supported by Twitter succeeds"""
|
||||||
|
self.api.get_supported_languages()
|
||||||
|
|
||||||
|
def test_privacy_policy(self):
|
||||||
|
"""Test getting Twitter's Privacy Policy succeeds"""
|
||||||
|
self.api.get_privacy_policy()
|
||||||
|
|
||||||
|
def test_get_tos(self):
|
||||||
|
"""Test getting the Twitter Terms of Service succeeds"""
|
||||||
|
self.api.get_tos()
|
||||||
|
|
||||||
def test_get_application_rate_limit_status(self):
|
def test_get_application_rate_limit_status(self):
|
||||||
"""Test getting application rate limit status succeeds"""
|
"""Test getting application rate limit status succeeds"""
|
||||||
self.oauth2_api.get_application_rate_limit_status()
|
self.oauth2_api.get_application_rate_limit_status()
|
||||||
|
|
|
||||||
|
|
@ -552,6 +552,16 @@ class EndpointsMixin(object):
|
||||||
"""
|
"""
|
||||||
return self.post('lists/members/destroy', params=params)
|
return self.post('lists/members/destroy', params=params)
|
||||||
|
|
||||||
|
def get_list_memberships(self, **params):
|
||||||
|
"""Returns the lists the specified user has been added to.
|
||||||
|
|
||||||
|
Docs: https://dev.twitter.com/docs/api/1.1/get/lists/memberships
|
||||||
|
|
||||||
|
"""
|
||||||
|
return self.get('lists/memberships', params=params)
|
||||||
|
get_list_memberships.iter_mode = 'cursor'
|
||||||
|
get_list_memberships.iter_key = 'lists'
|
||||||
|
|
||||||
def get_list_subscribers(self, **params):
|
def get_list_subscribers(self, **params):
|
||||||
"""Returns the subscribers of the specified list.
|
"""Returns the subscribers of the specified list.
|
||||||
|
|
||||||
|
|
@ -804,6 +814,39 @@ class EndpointsMixin(object):
|
||||||
return self.post('oauth2/invalidate_token', params=params)
|
return self.post('oauth2/invalidate_token', params=params)
|
||||||
|
|
||||||
# Help
|
# Help
|
||||||
|
def get_twitter_configuration(self, **params):
|
||||||
|
"""Returns the current configuration used by Twitter
|
||||||
|
|
||||||
|
Docs: https://dev.twitter.com/docs/api/1.1/get/help/configuration
|
||||||
|
|
||||||
|
"""
|
||||||
|
return self.get('help/configuration', params=params)
|
||||||
|
|
||||||
|
def get_supported_languages(self, **params):
|
||||||
|
"""Returns the list of languages supported by Twitter along with
|
||||||
|
their ISO 639-1 code.
|
||||||
|
|
||||||
|
Docs: https://dev.twitter.com/docs/api/1.1/get/help/languages
|
||||||
|
|
||||||
|
"""
|
||||||
|
return self.get('help/languages', params=params)
|
||||||
|
|
||||||
|
def get_privacy_policy(self, **params):
|
||||||
|
"""Returns Twitter's Privacy Policy
|
||||||
|
|
||||||
|
Docs: https://dev.twitter.com/docs/api/1.1/get/help/privacy
|
||||||
|
|
||||||
|
"""
|
||||||
|
return self.get('help/privacy', params=params)
|
||||||
|
|
||||||
|
def get_tos(self, **params):
|
||||||
|
"""Return the Twitter Terms of Service
|
||||||
|
|
||||||
|
Docs: https://dev.twitter.com/docs/api/1.1/get/help/tos
|
||||||
|
|
||||||
|
"""
|
||||||
|
return self.get('help/tos', params=params)
|
||||||
|
|
||||||
def get_application_rate_limit_status(self, **params):
|
def get_application_rate_limit_status(self, **params):
|
||||||
"""Returns the current rate limits for methods belonging to the
|
"""Returns the current rate limits for methods belonging to the
|
||||||
specified resource families.
|
specified resource families.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue