def tweet_search(log, item, limit=50):
log.debug(" Searching twitter for %s", item)
check_twitter_config()
if len(item) > 500:
log.error(" Search string too long")
raise Exception("Search string too long: %d", len(item))
logging.captureWarnings(True)
old_level = log.getEffectiveLevel()
log.setLevel(logging.ERROR)
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
try:
result = twitter.search(q=item, count=limit)
except TwythonAuthError, e:
twitter_auth_issue(e)
raise
except:
raise
log.setLevel(old_level)
return result
评论列表
文章目录