librelist archives

« back to archive

How to stream http request with Flask-Oauthlib

How to stream http request with Flask-Oauthlib

From:
suefantasy .
Date:
2014-07-08 @ 11:15
Hi all,

I'm building an app that tries to get data from a third party app, say
twitter, by making request to twitter constantly, like automatically every
10s.

So far, I've got access token from the third party, after creating an
OAuthRemoteApp
<https://flask-oauthlib.readthedocs.org/en/latest/api.html#developer-interface>
object called 'twitter' with flask-oauthlib library, and able to make
request through twitter.get(). But I don't know how to perform this request
constantly.

I found this snippet called 'stream proxy with requests
<http://flask.pocoo.org/snippets/118/>', which seems promising, but I don't
know how to integrate it with a url that needs third party authorization,
as seen in my example above~

Any ideas? Thanks!

Re: [flask] How to stream http request with Flask-Oauthlib

From:
Brice Leroy
Date:
2014-07-08 @ 16:59
Hi Sue,

Checkout Celery Periodic Task :
http://celery.readthedocs.org/en/latest/userguide/periodic-tasks.html


On Tue, Jul 8, 2014 at 4:15 AM, suefantasy . <suefantasy08@gmail.com> wrote:

> Hi all,
>
> I'm building an app that tries to get data from a third party app, say
> twitter, by making request to twitter constantly, like automatically every
> 10s.
>
> So far, I've got access token from the third party, after creating an
> OAuthRemoteApp
> <https://flask-oauthlib.readthedocs.org/en/latest/api.html#developer-interface>
> object called 'twitter' with flask-oauthlib library, and able to make
> request through twitter.get(). But I don't know how to perform this request
> constantly.
>
> I found this snippet called 'stream proxy with requests
> <http://flask.pocoo.org/snippets/118/>', which seems promising, but I
> don't know how to integrate it with a url that needs third party
> authorization, as seen in my example above~
>
> Any ideas? Thanks!
>



-- 
Brice Leroy

Re: [flask] How to stream http request with Flask-Oauthlib

From:
suefantasy .
Date:
2014-07-08 @ 17:33
Hi Brice,

Thanks for your reply. Checking it right now, seems just my medicine :)

Best,
Sue


2014-07-08 17:59 GMT+01:00 Brice Leroy <brice.leroy@sodahead.com>:

> Hi Sue,
>
> Checkout Celery Periodic Task :
> http://celery.readthedocs.org/en/latest/userguide/periodic-tasks.html
>
>
> On Tue, Jul 8, 2014 at 4:15 AM, suefantasy . <suefantasy08@gmail.com>
> wrote:
>
>> Hi all,
>>
>> I'm building an app that tries to get data from a third party app, say
>> twitter, by making request to twitter constantly, like automatically every
>> 10s.
>>
>> So far, I've got access token from the third party, after creating an
>> OAuthRemoteApp
>> <https://flask-oauthlib.readthedocs.org/en/latest/api.html#developer-interface>
>> object called 'twitter' with flask-oauthlib library, and able to make
>> request through twitter.get(). But I don't know how to perform this request
>> constantly.
>>
>> I found this snippet called 'stream proxy with requests
>> <http://flask.pocoo.org/snippets/118/>', which seems promising, but I
>> don't know how to integrate it with a url that needs third party
>> authorization, as seen in my example above~
>>
>> Any ideas? Thanks!
>>
>
>
>
> --
> Brice Leroy
>