hack in support for retweets in the Status

This commit is contained in:
Brian S. Stephan 2010-12-16 13:02:37 -06:00
parent 1bacfe047e
commit e2989b639c
1 changed files with 12 additions and 3 deletions

View File

@ -110,6 +110,7 @@ class Status(object):
status.place
status.coordinates
status.contributors
status.retweeted_status
'''
def __init__(self,
created_at=None,
@ -130,7 +131,8 @@ class Status(object):
geo=None,
place=None,
coordinates=None,
contributors=None):
contributors=None,
retweeted_status=None):
'''An object to hold a Twitter status message.
This class is normally instantiated by the twitter.Api class and
@ -177,6 +179,7 @@ class Status(object):
self.place = place
self.coordinates = coordinates
self.contributors = contributors
self.retweeted_status = retweeted_status
def GetCreatedAt(self):
'''Get the time this status message was posted.
@ -471,7 +474,8 @@ class Status(object):
self.geo == other.geo and \
self.place == other.place and \
self.coordinates == other.coordinates and \
self.contributors == other.contributors
self.contributors == other.contributors and \
self.retweeted_status == other.retweeted_status
except AttributeError:
return False
@ -545,6 +549,10 @@ class Status(object):
Returns:
A twitter.Status instance
'''
if not data:
return None
if 'user' in data:
user = User.NewFromJsonDict(data['user'])
else:
@ -576,7 +584,8 @@ class Status(object):
geo=data.get('geo', None),
place=data.get('place', None),
coordinates=data.get('coordinates', None),
contributors=data.get('contributors', None))
contributors=data.get('contributors', None),
retweeted_status=Status.NewFromJsonDict(data.get('retweeted_status', None)))
class User(object):