[Flask] flask-android maintain variable between requests

aiman parvaiz aimanparvaiz at gmail.com
Sat Jan 16 22:16:04 EST 2016


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20160116/5bec072f/attachment.html>


More information about the Flask mailing list