Created
October 31, 2013 14:06
-
-
Save thieman/7250389 to your computer and use it in GitHub Desktop.
Python Twitter Query-and-Grab
This file contains hidden or 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
""" 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