Skip to content

Commit

Permalink
adjust GetReplies for api v1.1
Browse files Browse the repository at this point in the history
NOTE we may deprecate this as it is now nothing but a special case
of GetUserTimeline
  • Loading branch information
bear committed Mar 18, 2013
1 parent 1bce0ba commit bc481d3
Showing 1 changed file with 29 additions and 38 deletions.
67 changes: 29 additions & 38 deletions twitter.py
Expand Up @@ -2982,33 +2982,33 @@ def PostRetweet(self, original_id, trim_user=False):
return Status.NewFromJsonDict(data)

def GetUserRetweets(self, count=None, since_id=None, max_id=None, trim_user=False):
'''Fetch the sequence of retweets made by the authenticated user.
The twitter.Api instance must be authenticated.
Args:
count:
The number of status messages to retrieve. [Optional]
since_id:
Returns results with an ID greater than (that is, more recent
than) the specified ID. There are limits to the number of
Tweets which can be accessed through the API. If the limit of
Tweets has occurred since the since_id, the since_id will be
forced to the oldest ID available. [Optional]
max_id:
Returns results with an ID less than (that is, older than) or
equal to the specified ID. [Optional]
'''Fetch the sequence of retweets made by the authenticated user.
The twitter.Api instance must be authenticated.
Args:
count:
The number of status messages to retrieve. [Optional]
since_id:
Returns results with an ID greater than (that is, more recent
than) the specified ID. There are limits to the number of
Tweets which can be accessed through the API. If the limit of
Tweets has occurred since the since_id, the since_id will be
forced to the oldest ID available. [Optional]
max_id:
Returns results with an ID less than (that is, older than) or
equal to the specified ID. [Optional]
trim_user:
If True the returned payload will only contain the user IDs,
otherwise the payload will contain the full user data item.
[Optional]
Returns:
A sequence of twitter.Status instances, one for each message up to count
'''
return self.GetUserTimeline(since_id=since_id, count=count, max_id=max_id, trim_user=trim_user, exclude_replies=True, include_rts=True)
Returns:
A sequence of twitter.Status instances, one for each message up to count
'''
return self.GetUserTimeline(since_id=since_id, count=count, max_id=max_id, trim_user=trim_user, exclude_replies=True, include_rts=True)

def GetReplies(self, since=None, since_id=None, page=None):
def GetReplies(self, since_id=None, count=None, max_id=None, trim_user=False):
'''Get a sequence of status messages representing the 20 most
recent replies (status updates prefixed with @twitterID) to the
authenticating user.
Expand All @@ -3020,27 +3020,18 @@ def GetReplies(self, since=None, since_id=None, page=None):
Tweets which can be accessed through the API. If the limit of
Tweets has occurred since the since_id, the since_id will be
forced to the oldest ID available. [Optional]
page:
Specifies the page of results to retrieve.
Note: there are pagination limits. [Optional]
since:
max_id:
Returns results with an ID less than (that is, older than) or
equal to the specified ID. [Optional]
trim_user:
If True the returned payload will only contain the user IDs,
otherwise the payload will contain the full user data item.
[Optional]
Returns:
A sequence of twitter.Status instances, one for each reply to the user.
'''
url = '%s/statuses/replies.json' % self.base_url
if not self._oauth_consumer:
raise TwitterError("The twitter.Api instance must be authenticated.")
parameters = {}
if since:
parameters['since'] = since
if since_id:
parameters['since_id'] = since_id
if page:
parameters['page'] = page
json = self._FetchUrl(url, parameters=parameters)
data = self._ParseAndCheckTwitter(json)
return [Status.NewFromJsonDict(x) for x in data]
return self.GetUserTimeline(since_id=since_id, count=count, max_id=max_id, trim_user=trim_user, exclude_replies=False, include_rts=False)

def GetRetweets(self, statusid):
'''Returns up to 100 of the first retweets of the tweet identified
Expand Down

3 comments on commit bc481d3

@bear
Copy link
Owner Author

@bear bear commented on bc481d3 Mar 22, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it broken or is the other just a better choice for getting replies? (i.e. do I need to make the change now or after the first pass?)

@bear
Copy link
Owner Author

@bear bear commented on bc481d3 Mar 22, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can I get you to file an issue for this? that will sit and stare at me until I fix it

@bear
Copy link
Owner Author

@bear bear commented on bc481d3 Mar 22, 2013 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.