Skip to content

Instantly share code, notes, and snippets.

@thieman
Created October 31, 2013 14:06
Show Gist options
  • Save thieman/7250389 to your computer and use it in GitHub Desktop.
Save thieman/7250389 to your computer and use it in GitHub Desktop.
Python Twitter Query-and-Grab
""" Logs Tweets based on filtered live stream """
from gamechanger.core.universe import Universe
from ConfigParser import ConfigParser
from tweetstream import FilterStream
def main():
universe = Universe.get_universe()
conn = universe.get_slave_connection(Universe.MONGO_CORE)
data = conn.data
config = ConfigParser()
config.read('twitter.conf')
keywords = ['one month free GCsports']
stream = FilterStream(config.get('Auth', 'username'),
config.get('Auth', 'password'),
track=keywords)
for tweet in stream:
data.tweetstream.insert(tweet)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment