Commit 4278e6ab authored by Bas Westerbaan's avatar Bas Westerbaan Committed by Joshua
Browse files

API methods lists(), lists_memberships(), and lists_subscriptions now accept 'user' parameter.


Added helpers to User model for lists.

Merged from bwesterb/tweepy @ f26e000ba04b57761578831792d7a7a1adfc8e41
Signed-off-by: default avatarJoshua <jroesslein@gmail.com>
parent d35d3b37
......@@ -5,6 +5,11 @@ during upgrade will be listed here.
===========================
+ Models
- Added some new helper methods to List model
- User model
- Added lists_memberships, lists_subscriptions, and lists helpers
+ API
- lists(), lists_memberships(), and lists_subscriptions() now
take an "user" parameter for specifying which user to query.
1.3 -> 1.4 [current]
===========================
......
......@@ -482,32 +482,26 @@ class API(object):
require_auth = True
)(self, *args, **kargs)
def lists(self, *args, **kargs):
return bind_api(
path = '/%s/lists.json' % self.auth.get_username(),
parser = parse_lists,
allowed_param = ['cursor'],
require_auth = True
)(self, *args, **kargs)
lists.pagination_mode = 'cursor'
lists = bind_api(
path = '/{user}/lists.json',
parser = parse_lists,
allowed_param = ['user', 'cursor'],
require_auth = True
)
def lists_memberships(self, *args, **kargs):
return bind_api(
path = '/%s/lists/memberships.json' % self.auth.get_username(),
parser = parse_lists,
allowed_param = ['cursor'],
require_auth = True
)(self, *args, **kargs)
lists_memberships.pagination_mode = 'cursor'
lists_memberships = bind_api(
path = '/{user}/lists/memberships.json',
parser = parse_lists,
allowed_param = ['user', 'cursor'],
require_auth = True
)
def lists_subscriptions(self, *args, **kargs):
return bind_api(
path = '/%s/lists/subscriptions.json' % self.auth.get_username(),
parser = parse_lists,
allowed_param = ['cursor'],
require_auth = True
)(self, *args, **kargs)
lists_subscriptions.pagination_mode = 'cursor'
lists_subscriptions = bind_api(
path = '/{user}/lists/subscriptions.json',
parser = parse_lists,
allowed_param = ['user', 'cursor'],
require_auth = True
)
list_timeline = bind_api(
path = '/{owner}/lists/{slug}/statuses.json',
......
......@@ -52,6 +52,15 @@ class User(Model):
self._api.destroy_friendship(user_id=self.id)
self.following = False
def lists_memberships(self):
return self._api.lists_memberships(user=self.screen_name)
def lists_subscriptions(self):
return self._api.lists_subscriptions(user=self.screen_name)
def lists(self):
return self._api.lists(user=self.screen_name)
class DirectMessage(Model):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment