简体   繁体   中英

Search twitter feeds with Tweepy

Thanks to @Nirvana Tikku, he solved my question on how to talk with Tweepy and perform simple search in this Question . The below are a series of code summary on how i authenticate my tweepy on GAE.

import tweepy

creds = json.loads(open('credential.json').read())
tw_consumer_key = creds['tw_consumer_key']
tw_consumer_secret = creds['tw_consumer_secret']
tw_access_token = creds['tw_access_token']
tw_access_token_secret = creds['tw_access_token_secret']

try:
    auth = tweepy.OAuthHandler(tw_consumer_key, tw_consumer_secret)
    auth.set_access_token(tw_access_token, tw_access_token_secret)
    api = tweepy.API(auth)
except Exception:
    print "Tweepy Error"
    service = None
    api = None 

I have a question after success authenticate the tweepy and could have a talk with it. I need to implement the streaming API to get LIVE feeds from twitter. Is anyone here could give me a guide on how to implement the "firehose"? some sample code, please. Thanks

Here's an answer from a similar question in the Tweepy forum: https://groups.google.com/forum/#!topic/tweepy/BLSRYzG1Tps

Quoting steveobd there: "GAE doesn't support listen sockets only outbound sockets ( https://developers.google.com/appengine/docs/python/sockets/ ). You'll have to use Google Compute Engine or Heroku or similar."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM