Moved patch files to subdirectory

This commit is contained in:
Anna 2010-05-24 15:54:08 -04:00
parent 59d9177f3a
commit 37e033ca34
6 changed files with 1 additions and 1 deletions

View file

@ -0,0 +1,56 @@
diff -r 51ac454d5d89 twitter.py
--- a/twitter.py Thu Dec 31 15:06:42 2009 -0500
+++ b/twitter.py Sun Apr 11 00:33:25 2010 -0400
@@ -493,6 +493,52 @@
self._CheckForTwitterError(data)
return [NewStatusFromJsonDict(x) for x in data]
+ def GetHomeTimeline(self,
+ count=None,
+ max_id=None,
+ since_id=None,
+ page=None):
+ '''Fetch the sequence of Status messages for the authenticated user and
+ the user's friends. Includes retweets.
+
+ The twitter.Api instance must be authenticated.
+
+ Args:
+ count:
+ Specifies the number of statuses to retrieve. May not be
+ greater than 200. [Optional]
+ since:
+ Narrows the returned results to just those statuses created
+ after the specified HTTP-formatted date. [Optional]
+ since_id:
+ Returns only public statuses with an ID greater than (that is,
+ more recent than) the specified ID. [Optional]
+
+ Returns:
+ A sequence of Status instances, one for each message
+ '''
+ if not self._username:
+ raise TwitterError("The twitter.Api instance must be authenticated.")
+ url = 'http://api.twitter.com/1/statuses/home_timeline.json'
+ parameters = {}
+ if count is not None:
+ try:
+ if int(count) > 200:
+ raise TwitterError("'count' may not be greater than 200")
+ except ValueError:
+ raise TwitterError("'count' must be an integer")
+ parameters['count'] = count
+ if max_id:
+ parameters['max_id'] = max_id
+ if since_id:
+ parameters['since_id'] = since_id
+ if page:
+ parameters['page'] = page
+ json = self._FetchUrl(url, parameters=parameters)
+ data = simplejson.loads(json)
+ self._CheckForTwitterError(data)
+ return [NewStatusFromJsonDict(x) for x in data]
+
def GetUserTimeline(self,
id=None,
user_id=None,

View file

@ -0,0 +1,58 @@
diff -r 51ac454d5d89 twitter.py
--- a/twitter.py Thu Dec 31 15:06:42 2009 -0500
+++ b/twitter.py Sat Apr 10 10:59:03 2010 -0400
@@ -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:
@@ -1117,6 +1118,46 @@
self._CheckForTwitterError(data)
return NewListFromJsonDict(data)
+ 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.
+
+ Args:
+ list_slug: slug of the list to fetch
+ user: the username or id of the user whose list you are fetching. If
+ 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.
+
+ Returns:
+ The list information.
+ '''
+ if not user and not self._username:
+ raise TwitterError("User must be specified if API is not authenticated.")
+ if user:
+ url = 'http://api.twitter.com/1/%s/lists/%s/statuses.json' % (user,list_slug)
+ else:
+ url = 'http://api.twitter.com/1/%s/lists/%s/statuses.json' % (self._username,list_slug)
+ 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)
+ data = simplejson.loads(json)
+ self._CheckForTwitterError(data)
+ return [NewStatusFromJsonDict(x) for x in data]
+
def Search(self,
query,
lang=None,

View file

@ -0,0 +1,53 @@
diff -r 51ac454d5d89 twitter.py
--- a/twitter.py Thu Dec 31 15:06:42 2009 -0500
+++ b/twitter.py Sun Apr 11 01:08:53 2010 -0400
@@ -722,6 +722,49 @@
self._CheckForTwitterError(data)
return [NewStatusFromJsonDict(x) for x in data]
+ def GetMentions(self, since_id=None, max_id=None, count=None, page=None):
+ '''Get a sequence of status messages representing status updates containing
+ @username for the authenticated user
+
+ Args:
+ since_id:
+ Returns only public statuses with an ID greater than (that is,
+ more recent than) the specified ID. [Optional]
+ max_id:
+ Returns only statuses with an ID less than (that is, older
+ than) or equal to the specified ID. [optional]
+ count:
+ Specifies the number of statuses to retrieve. May not be
+ greater than 200. [optional]
+ page:
+ Specifies the page of results to retrieve. Note: there are
+ pagination limits. [optional]
+
+ Returns:
+ A sequence of Status instances, one for each mention of the user.
+ '''
+ url = 'http://api.twitter.com/1/statuses/mentions.json'
+ if not self._username:
+ raise TwitterError("The twitter.Api instance must be authenticated.")
+ parameters = {}
+ if since_id:
+ parameters['since_id'] = since_id
+ if max_id:
+ parameters['max_id'] = max_id
+ if count:
+ try:
+ if int(count) > 200:
+ raise TwitterError("'count' may not be greater than 200")
+ except ValueError:
+ raise TwitterError("'count' must be an integer")
+ parameters['count'] = count
+ if page:
+ parameters['page'] = page
+ json = self._FetchUrl(url, parameters=parameters)
+ data = simplejson.loads(json)
+ self._CheckForTwitterError(data)
+ return [NewStatusFromJsonDict(x) for x in data]
+
def GetFavorites(self,
user=None,
page=None):

View file

@ -0,0 +1,28 @@
diff -r 51ac454d5d89 twitter.py
--- a/twitter.py Thu Dec 31 15:06:42 2009 -0500
+++ b/twitter.py Fri Apr 16 17:30:32 2010 -0400
@@ -221,6 +221,7 @@
_CopyProperty(data, user, 'profile_link_color', 'profile.link_color')
_CopyProperty(data, user, 'profile_text_color', 'profile.text_color')
_CopyProperty(data, user, 'protected')
+ _CopyProperty(data, user, 'verified')
_CopyProperty(data, user, 'utc_offset')
_CopyProperty(data, user, 'time_zone')
_CopyProperty(data, user, 'url')
diff -r 51ac454d5d89 twitter_pb2.py
--- a/twitter_pb2.py Thu Dec 31 15:06:42 2009 -0500
+++ b/twitter_pb2.py Fri Apr 16 17:30:32 2010 -0400
@@ -253,6 +253,13 @@
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
+ descriptor.FieldDescriptor(
+ name='verified', full_name='twitter.User.verified', index=18,
+ number=19, type=8, cpp_type=7, label=1,
+ default_value=False,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ options=None),
],
extensions=[
],

View file

@ -0,0 +1,34 @@
diff -r 51ac454d5d89 twitter.py
--- a/twitter.py Thu Dec 31 15:06:42 2009 -0500
+++ b/twitter.py Sat Apr 10 10:42:52 2010 -0400
@@ -690,6 +690,30 @@
results.append(self.PostUpdate(lines[-1], **kwargs))
return results
+ def PostRetweet(self, id):
+ '''Retweet a tweet with the Retweet API
+
+ The twitter.Api instance must be authenticated.
+
+ Args:
+ id: The numerical ID of the tweet you are retweeting
+
+ Returns:
+ A twitter.Status instance representing the retweet posted
+ '''
+ if not self._username:
+ raise TwitterError("The twitter.Api instance must be authenticated.")
+ try:
+ if int(id) <= 0:
+ raise TwitterError("'id' must be a positive number")
+ except ValueError:
+ raise TwitterError("'id' must be an integer")
+ url = 'http://api.twitter.com/1/statuses/retweet/%s.json' % id
+ json = self._FetchUrl(url, post_data={})
+ data = simplejson.loads(json)
+ self._CheckForTwitterError(data)
+ return NewStatusFromJsonDict(data)
+
def GetReplies(self, since=None, since_id=None, page=None):
'''Get a sequence of status messages representing the 20 most recent
replies (status updates prefixed with @username) to the authenticating