diff --git a/HISTORY.rst b/HISTORY.rst index 4d60acb..de27f4d 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -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. - 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. +- Added methods ``get_list_memberships``, ``get_twitter_configuration``, ``get_supported_languages``, ``get_privacy_policy``, ``get_tos`` 3.0.0 (2013-06-18) ++++++++++++++++++ diff --git a/tests/test_core.py b/tests/test_core.py index b54f729..710ba1b 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -385,6 +385,10 @@ class TwythonAPITestCase(unittest.TestCase): 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): """Test list of subscribers of a specific list succeeds""" 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') # 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): """Test getting application rate limit status succeeds""" self.oauth2_api.get_application_rate_limit_status() diff --git a/twython/endpoints.py b/twython/endpoints.py index bb70f0e..87db2a3 100644 --- a/twython/endpoints.py +++ b/twython/endpoints.py @@ -552,6 +552,16 @@ class EndpointsMixin(object): """ 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): """Returns the subscribers of the specified list. @@ -804,6 +814,39 @@ class EndpointsMixin(object): return self.post('oauth2/invalidate_token', params=params) # 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): """Returns the current rate limits for methods belonging to the specified resource families.