Improved the GetListStatuses patch

This commit is contained in:
Anna 2010-04-10 11:03:33 -04:00
parent 74b42441dc
commit 5fbfb01c85

View File

@ -1,6 +1,6 @@
diff -r 51ac454d5d89 twitter.py diff -r 51ac454d5d89 twitter.py
--- a/twitter.py Thu Dec 31 15:06:42 2009 -0500 --- a/twitter.py Thu Dec 31 15:06:42 2009 -0500
+++ b/twitter.py Tue Apr 06 15:05:55 2010 -0400 +++ b/twitter.py Sat Apr 10 10:59:03 2010 -0400
@@ -380,6 +380,7 @@ @@ -380,6 +380,7 @@
>>> api.GetUserLists(user, cursor) >>> api.GetUserLists(user, cursor)
>>> api.GetListMembers(list_slug, user, cursor) >>> api.GetListMembers(list_slug, user, cursor)
@ -9,17 +9,24 @@ diff -r 51ac454d5d89 twitter.py
Example usage of lists: Example usage of lists:
@@ -1117,6 +1118,31 @@ @@ -1117,6 +1118,46 @@
self._CheckForTwitterError(data) self._CheckForTwitterError(data)
return NewListFromJsonDict(data) return NewListFromJsonDict(data)
+ def GetListStatuses(self, list_slug, user=None): + def GetListStatuses(self, list_slug, user=None, since_id=None, max_id=None, per_page=None, page=None):
+ '''Fetch the List statuses for a given user / list. + '''Fetch the List statuses for a given user / list.
+ +
+ Args: + Args:
+ list_slug: slug of the list to fetch + list_slug: slug of the list to fetch
+ user: the username or id of the user whose friends you are fetching. If + user: the username or id of the user whose list you are fetching. If
+ not specified, defaults to the authenticated user. [optional] + not specified, defaults to the authenticated user. [optional]
+ 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]
+ +
+ The twitter.Api instance must be authenticated. + The twitter.Api instance must be authenticated.
+ +
@ -33,6 +40,14 @@ diff -r 51ac454d5d89 twitter.py
+ else: + else:
+ url = 'http://twitter.com/%s/lists/%s/statuses.json' % (self._username,list_slug) + url = 'http://twitter.com/%s/lists/%s/statuses.json' % (self._username,list_slug)
+ parameters = {} + parameters = {}
+ 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
+ json = self._FetchUrl(url, parameters=parameters) + json = self._FetchUrl(url, parameters=parameters)
+ data = simplejson.loads(json) + data = simplejson.loads(json)
+ self._CheckForTwitterError(data) + self._CheckForTwitterError(data)