Added functionality to get retweets in the home timeline, fixing the missing tweet problem (partially)
This commit is contained in:
parent
3e41885bbe
commit
1c92c34dd9
|
@ -71,7 +71,7 @@ class MyTwitter():
|
|||
|
||||
def update_window(self):
|
||||
if self.list is None or self.list == 'Home':
|
||||
statuses = self.api.GetFriendsTimeline(self.username, count=self.num_entries)
|
||||
statuses = self.api.GetHomeTimeline(count=self.num_entries)
|
||||
elif self.list == '@' + self.username:
|
||||
statuses = self.api.GetReplies()
|
||||
else:
|
||||
|
|
56
python-twitter-GetHomeTimeline.patch
Normal file
56
python-twitter-GetHomeTimeline.patch
Normal 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,
|
Reference in New Issue
Block a user