Created
March 3, 2014 15:36
-
-
Save zdepablo/9327508 to your computer and use it in GitHub Desktop.
Search tweets using TwitterAPI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from TwitterAPI import TwitterAPI | |
# Go to http://dev.twitter.com and create an app. | |
# The consumer key and secret will be generated for you after | |
consumer_key = <consumer-key> | |
consumer_secret = <consumer-secret> | |
# After the step above, you will be redirected to your app's page. | |
# Create an access token under the the "Your access token" section | |
access_token_key = <access-token-key> | |
access_token_secret = <access-token-secret> | |
# Create a Twitter client | |
twitter = TwitterAPI(consumer_key, consumer_secret, access_token_key, access_token_secret) | |
query = {'q' : 'Top Chef', 'lang' : 'es', 'count': 100} | |
results = twitter.request('search/tweets', query ) | |
for tweet in results.get_iterator(): | |
print tweet['id'], tweet['text'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment