New to Python Twitter Search API

python
search

#1

I am trying to search for tweets with particular hashtags or keywords and save them in a list. But i am not able to access the tweets from the list itself.
The following code:
twitter = Twitter(auth = oauth)
content = twitter.search.tweets(q=’#oreo’, result_type=‘recent’, lang=‘en’, count=10)

runs smoothly but I am not able to access the data stored in content.
On running:
content[0][‘user’][‘screen_name’]

I get an error:
KeyError: 0

How do I store the result of my queries thruogh the API?


#2

Which Python library are you using?


#3

from twitter import Twitter, OAuth, TwitterHTTPError, TwitterStream

This is the import statement. Python version being 3.5.2


#4

Thanks for getting back in touch here. It might be helpful to see a full version of the code you are working on. Do you have a full code snippet I can look at? I’ve personally had a lot of success with using the Search Tweets Python wrapper.