From dd3727c6f544eda3cb68885d22b3fe672848ab60 Mon Sep 17 00:00:00 2001 From: Mike Helmick Date: Sat, 20 Jul 2013 17:22:07 -0400 Subject: [PATCH] Fixes #243 --- HISTORY.rst | 1 + tests/test_core.py | 4 ++++ twython/endpoints.py | 10 ++++++++++ 3 files changed, 15 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 4d60acb..e9a8054 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 method ``get_list_memberships`` 3.0.0 (2013-06-18) ++++++++++++++++++ diff --git a/tests/test_core.py b/tests/test_core.py index b54f729..3e0cfcc 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, diff --git a/twython/endpoints.py b/twython/endpoints.py index bb70f0e..7f709e0 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.