Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
An example how to get all tweets containing a hashtag (here #BOSC2015) and storing each tweets as JSON string.
from TwitterSearch import *
import json
try:
tso = TwitterSearchOrder()
tso.set_keywords(['#BOSC2015'])
# Please replace with your credentials
ts = TwitterSearch(
consumer_key='REPLACE_ME',
consumer_secret='REPLACE_ME',
access_token='REPLACE_ME',
access_token_secret='REPLACE_ME'
)
for tweet in ts.search_tweets_iterable(tso):
print(json.dumps(tweet))
except TwitterSearchException as e:
print(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment