Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed Issue #1443 #1444

Merged
merged 4 commits into from
Dec 26, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 17 additions & 2 deletions tweepy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,21 @@ def lists_memberships(self):
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
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be part of a separate pull request, which should also add documentation for the method.

@property
def lists_subscriptions(self):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscriptions
Expand Down Expand Up @@ -1158,14 +1173,14 @@ def _remove_list_members(self):
def list_members(self):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members
:allowed_param: 'owner_screen_name', 'slug', 'list_id', 'owner_id',
'cursor'
'cursor', 'count'
"""
return bind_api(
api=self,
path='/lists/members.json',
payload_type='user', payload_list=True,
allowed_param=['owner_screen_name', 'slug', 'list_id', 'owner_id',
'cursor']
'cursor', 'count']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also be part of another separate pull request, which should also add documentation for the new allowed parameter.

)

@property
Expand Down
11 changes: 8 additions & 3 deletions tweepy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,22 @@ def unfollow(self):
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_ownerships(user_id=self.id,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be part of the separate pull request that adds API.lists_ownerships.

*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)

Expand Down