From 37b92ccce60e05fe589336da730a08ef05d3ba07 Mon Sep 17 00:00:00 2001 From: brett-schneider Date: Fri, 2 Oct 2020 21:38:36 +0200 Subject: [PATCH] fixed Issue 106 --- tweepy/api.py | 15 +++++++++++++++ tweepy/models.py | 11 ++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/tweepy/api.py b/tweepy/api.py index 4a2599c..262fbb7 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -1034,6 +1034,21 @@ class API(object): require_auth=True ) + @property + def lists_ownerships(self): + """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-ownerships + :allowed_param: 'screen_name', 'user_id', + 'cursor', 'count' + """ + return bind_api( + api=self, + path='/lists/ownerships.json', + payload_type='list', payload_list=True, + allowed_param=['screen_name', 'user_id', + 'cursor', 'count'], + require_auth=True + ) + @property def lists_subscriptions(self): """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscriptions diff --git a/tweepy/models.py b/tweepy/models.py index dd14d6e..5e0bab5 100644 --- a/tweepy/models.py +++ b/tweepy/models.py @@ -196,17 +196,22 @@ class User(Model): self.following = False def lists_memberships(self, *args, **kwargs): - return self._api.lists_memberships(user=self.screen_name, + return self._api.lists_memberships(user_id=self.id, + *args, + **kwargs) + + def lists_ownerships(self, *args, **kwargs): + return self._api.lists_memberships(user_id=self.id, *args, **kwargs) def lists_subscriptions(self, *args, **kwargs): - return self._api.lists_subscriptions(user=self.screen_name, + return self._api.lists_subscriptions(user_id=self.id, *args, **kwargs) def lists(self, *args, **kwargs): - return self._api.lists_all(user=self.screen_name, + return self._api.lists_all(user_id=self.id, *args, **kwargs) -- 2.25.1