Does Tweepy Streaming API work on Google App Engine?

110 views
Skip to first unread message

NP

unread,
Aug 25, 2016, 12:33:12 PM8/25/16
to Google App Engine

I'm trying to use the Tweepy Library to follow a user. This means using the Streaming API. I'm using the Google App Engine SDK release: "1.9.40". Everything works on my Dev server but when I deploy to Production, it stops working. I don't get an error.

Basically what is happening is - the code I have in on_status is not being triggered i.e. my app seems not to be listening to the on_status event. I added a checkpoint and it is not being printed to the log file. But on Dev, it is being triggered.


def on_status(self, status):
    decoded = json.loads(status)
    logger.info(decoded) # Checkpoint


Am I doing something wrong or is this not supported in App Engine?  And if it is not supported, how come it works on the Dev env? Finally, what are my alternatives?


Thanks

Blaine Garrett

unread,
Aug 26, 2016, 2:01:31 PM8/26/16
to Google App Engine
I don't know anything about Tweepy, but I'm betting you need to register your domain on the Tweepy side of things as is with most 3rd party APIs. Otherwise, are you getting any errors in the logs?

Barry Hunter

unread,
Aug 26, 2016, 2:11:01 PM8/26/16
to google-appengine
A 'streaming API' implies, you open a long running socket connection, and events are streamed when available.

... this doesnt seem a good fit AppEngine as such. Its a 'request/response' basis. So the thread is torn down (the request is over) before any data received.

The Dev server may be less strict about imposing this, and will hold the process open.


Traditionally Backends might of worked
https://cloud.google.com/appengine/docs/python/backends/


Now a manual scaling instance, would give similar functionality
https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine
.. the instance can remain in memory. (although I dont know it the socket API supports long running connections.

https://cloud.google.com/appengine/docs/python/sockets/
does mention unused connections may die after 2 minutes of inactivity.


(guessing, but maybe the 'Tweepy Library' will need patching to use the Sockets API directly, rather than native python sockets)



On 26 August 2016 at 19:01, Blaine Garrett <bla...@blainegarrett.com> wrote:
I don't know anything about Tweepy, but I'm betting you need to register your domain on the Tweepy side of things as is with most 3rd party APIs. Otherwise, are you getting any errors in the logs?

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/ade535a9-9de0-4417-b9f8-42ab620717f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages