예제 #1
0
import twitteroauth
from muchtwitter.models.twitter import TweetProcessor
from gui import Gui
from muchtwitter.models.logs import Logger
from muchtwitter.models.document import Document, DocQueue, WordDictionary
import time

QUERY_FREQ = 5000

# SEARCH_TERM = "Chicago"
logger = Logger()
api = twitteroauth.getAuthenticatedApi()
tweetprocessor = TweetProcessor()
gui = None
docWords = DocQueue(10)
wordDict = WordDictionary()

def searchEvent():

    SEARCH_TERM = get_string()
    print SEARCH_TERM
    if len(SEARCH_TERM) > 0:
        results = api.GetSearch(SEARCH_TERM, lang="en")

        start_time = time.time()
        resultString = ""
        for result in results:
            logger.logTweet(result)
            resultString+= ' ' + result.text
        resultString.lower()
        print resultString.encode('utf-8')
 def __init__(self, twitterApi):
     self.api = twitteroauth.getAuthenticatedApi()
     self.lang = "en"
     self.resultType = "mixed"
     self.geocode = None