Suppose I do
tweets = api.home_timeline()
It returns a list of 20 recent tweepy status objects that is posted on my timeline.And if I do
for tweet in tweets:
print tweet.text
It prints 20 messages.Is it possible to retrieve the time the status was posted? What other attributes does the status object have? Help needed.
In order to get the date and time when the status was posted, we have to do the following : Identify the status ID of the status from the GUI. Get the Status object of the status using the get_status() method with the status ID. From this object, fetch the created_at attribute present in it.
Returns full Tweet objects for up to 100 Tweets per request, specified by the id parameter.
GET statuses/show/:id Returns a single Tweet, specified by the id parameter. The Tweet's author will also be embedded within the Tweet.
tweet = tweets[0]
print tweet.created_at
Output will be a datetime object. E.g.:
(Pdb) tweet.created_at
datetime.datetime(2012, 6, 3, 20, 9, 24)
For all attributes, see the Twitter API docs. Tweepy docs will also interest you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With