2010-04-07 16:54:40 +00:00
|
|
|
diff -r 51ac454d5d89 twitter.py
|
|
|
|
--- a/twitter.py Thu Dec 31 15:06:42 2009 -0500
|
2010-04-10 15:03:33 +00:00
|
|
|
+++ b/twitter.py Sat Apr 10 10:59:03 2010 -0400
|
2010-04-07 16:54:40 +00:00
|
|
|
@@ -380,6 +380,7 @@
|
|
|
|
>>> api.GetUserLists(user, cursor)
|
|
|
|
>>> api.GetListMembers(list_slug, user, cursor)
|
|
|
|
>>> api.GetList(list_slug, user)
|
|
|
|
+ >>> api.GetListStatuses(list_slug, user)
|
|
|
|
|
|
|
|
Example usage of lists:
|
|
|
|
|
2010-04-10 15:03:33 +00:00
|
|
|
@@ -1117,6 +1118,46 @@
|
2010-04-07 16:54:40 +00:00
|
|
|
self._CheckForTwitterError(data)
|
|
|
|
return NewListFromJsonDict(data)
|
|
|
|
|
2010-04-10 15:03:33 +00:00
|
|
|
+ def GetListStatuses(self, list_slug, user=None, since_id=None, max_id=None, per_page=None, page=None):
|
2010-04-07 16:54:40 +00:00
|
|
|
+ '''Fetch the List statuses for a given user / list.
|
|
|
|
+
|
|
|
|
+ Args:
|
|
|
|
+ list_slug: slug of the list to fetch
|
2010-04-10 15:03:33 +00:00
|
|
|
+ user: the username or id of the user whose list you are fetching. If
|
2010-04-07 16:54:40 +00:00
|
|
|
+ not specified, defaults to the authenticated user. [optional]
|
2010-04-10 15:03:33 +00:00
|
|
|
+ since_id: return only statuses with an ID greater than the specified ID
|
|
|
|
+ [optional]
|
|
|
|
+ max_id: return only statuses with an ID less than or equal to the
|
|
|
|
+ specified ID [optional]
|
|
|
|
+ per_page: specifies the maximum number of statuses to retrieve. Must be
|
|
|
|
+ <= 200 [optional]
|
|
|
|
+ page: specifies the page to retrieve [optional]
|
2010-04-07 16:54:40 +00:00
|
|
|
+
|
|
|
|
+ The twitter.Api instance must be authenticated.
|
|
|
|
+
|
|
|
|
+ Returns:
|
|
|
|
+ The list information.
|
|
|
|
+ '''
|
|
|
|
+ if not user and not self._username:
|
|
|
|
+ raise TwitterError("User must be specified if API is not authenticated.")
|
|
|
|
+ if user:
|
2010-05-21 16:11:57 +00:00
|
|
|
+ url = 'http://api.twitter.com/1/%s/lists/%s/statuses.json' % (user,list_slug)
|
2010-04-07 16:54:40 +00:00
|
|
|
+ else:
|
2010-05-21 16:11:57 +00:00
|
|
|
+ url = 'http://api.twitter.com/1/%s/lists/%s/statuses.json' % (self._username,list_slug)
|
2010-04-07 16:54:40 +00:00
|
|
|
+ parameters = {}
|
2010-04-10 15:03:33 +00:00
|
|
|
+ if since_id:
|
|
|
|
+ parameters['since_id']=since_id
|
|
|
|
+ if max_id:
|
|
|
|
+ parameters['max_id']=max_id
|
|
|
|
+ if per_page:
|
|
|
|
+ parameters['per_page']=per_page
|
|
|
|
+ if page:
|
|
|
|
+ parameters['page']=page
|
2010-04-07 16:54:40 +00:00
|
|
|
+ json = self._FetchUrl(url, parameters=parameters)
|
|
|
|
+ data = simplejson.loads(json)
|
|
|
|
+ self._CheckForTwitterError(data)
|
|
|
|
+ return [NewStatusFromJsonDict(x) for x in data]
|
|
|
|
+
|
|
|
|
def Search(self,
|
|
|
|
query,
|
|
|
|
lang=None,
|