How do I interact with the Tweepy Result set? How can I extract information? It kinda looks like a list or a dictionary, but I'm having trouble extracting specific elements of it.
import tweepy
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
print(type(api.favorites('twitter')))
Out[1]: <class 'tweepy.models.ResultSet'>
print(api.favorites('twitter'))
Out[2]: Status(favorited=False, source='Twitter for iPhone', in_reply_to_status_id=None, coordinates=None, text='Starting the Twitter chat now. https://t.co[...]
I've never dealt with an object like ResultSet before, so I'm not sure how I can extract information from it. I noticed that it works a bit like a list, in that I can get a specific tweet from the list like this:
print(api.favorites('twitter')[1])
But I cant get embedded elements like this:
print(api.favorites('twitter')[1][0])
Out[3]: TypeError: 'Status' object does not support indexing
or like this:
print(api.favorites('twitter')[1]['favorited'])
Out[4]: TypeError: 'Status' object is not subscriptable
Any help is appreciated!