[Flask] flask-android maintain variable between requests

Bryan Corralejo corralejob at gmail.com
Sat Jan 16 22:26:30 EST 2016


You could store the data in a session for the user. Flask-session offers an
interface into  redis/memcached for server side sessions or you can store
it in a session cookie and have the data sent with every request.
On Jan 16, 2016 9:16 PM, "aiman parvaiz" <aimanparvaiz at gmail.com> wrote:

> Hi all
> I am new to flask and am writing API for a simple video upload android
> app. App uses whatsapp like one time password authentication and the user
> stays logged in. App has user role and every user has a uuid associated
> with it. For every end point app sends a uuid to the server and I use that
> uuid to talk to the DB to get the role of the user. I want to skip this
> step of going to DB and getting the user role. I wanted to know what would
> be the best way to get the role from DB once and store it somewhere for all
> the subsequent user requests till this user logs out. In my limited
> knowledge flask.g won’t work beyond the first request by the user(As it is
> valid only for one request) and browser like sessions can’t be supported in
> the android app(we tried making requests from the app but session['id'] is
> not available for usage. Same code worked fine on a browser). Should I be
> looking in to storing a simple key:value in redis/memcahced or is there a
> better way to approach this issue. Also, I would be using uwsgi and nginx
> to host this backend.
>
> Any help would be appreciated please.
> Thanks
>
> _______________________________________________
> Flask mailing list
> Flask at python.org
> https://mail.python.org/mailman/listinfo/flask
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20160116/8015cbdc/attachment.html>


More information about the Flask mailing list