I am using tweepy and python 2.7.6 to return the tweets of a specified user
My code looks like:
import tweepy
ckey = 'myckey'
csecret = 'mycsecret'
atoken = 'myatoken'
asecret = 'myasecret'
auth = tweepy.OAuthHandler(ckey, csecret)
auth.set_access_token(atoken, asecret)
api = tweepy.API(auth)
stuff = api.user_timeline(screen_name = 'danieltosh', count = 100, include_rts = True)
print stuff
However this yields a set of messages which look like<tweepy.models.Status object at 0x7ff2ca3c1050>
Is it possible to print out useful information from these objects? where can I find all of their attributes?
Unfortunately, Status
model is not really well documented in the tweepy
docs.
user_timeline()
method returns a list of Status
object instances. You can explore the available properties and methods using dir()
, or look at the actual implementation.
For example, from the source code you can see that there are author
, user
and other attributes:
for status in stuff:
print status.author, status.user
Or, you can print out the _json
attribute value which contains the actual response of an API call:
for status in stuff:
print status._json