Search twitter feeds with Tweepy

2019-06-06 14:29发布

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

1条回答
Rolldiameter
2楼-- · 2019-06-06 14:48

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."

查看更多
登录 后发表回答