session

Flask permanent session: where to define them?

Flask permanent session: where to define them? Question: By default, Flask uses volatile sessions, which means the session cookie is set to expire when browser closes. In order to use permanent sessions, which will use a cookie with a defined expiration date, one should set session.permanent = True, as is mentioned in this question., and …

Total answers: 4

Flask: 'session' vs. 'g'?

Flask: 'session' vs. 'g'? Question: I’m trying to understand the differences in functionality and purpose between g and session. Both are objects to ‘hang’ session data on, am I right? If so, what exactly are the differences and which one should I use in what cases? Asked By: Aviv Cohn || Source Answers: No, g …

Total answers: 1

Is it possible to "transfer" a session between selenium.webdriver and requests.session

Is it possible to "transfer" a session between selenium.webdriver and requests.session Question: In theory, if I copy all of the cookies from selenium’s webdriver object to requests.Session object, would requests be able to continue on as if the session was not interrupted? Specifically, I am interested in writing automation where I get to specific location …

Total answers: 1

Why not generate the secret key every time Flask starts?

Why not generate the secret key every time Flask starts? Question: When using sessions, Flask requires a secret key. In every example I’ve seen, the secret key is somehow generated and then stored either in source code or in configuration file. What is the reason to store it permanently? Why not simply generate it when …

Total answers: 1

Django session key based expiration

Django session key based expiration Question: I’m using Django sessions and I want to set expiry for a particular key. In an AJAX view I’m doing the following request.session[‘a’] = True request.session.set_expiry(604800) Does this set the expiry for that particular key or that session? I’m setting the sessions for other keys in other AJAX views …

Total answers: 2

secret key not set in flask session, using the Flask-Session extension

secret key not set in flask session, using the Flask-Session extension Question: Right now I am using a flask 3rd party library Flask-Session and I am having no luck getting a session working. When I connect to my site, I get the following error: RuntimeError: the session is unavailable because no secret key was set. …

Total answers: 3

Sql Alchemy QueuePool limit overflow

Sql Alchemy QueuePool limit overflow Question: I have a Sql Alchemy application that is returning TimeOut: TimeoutError: QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30 I read in a different post that this happens when I don’t close the session but I don’t know if this applies to my code: …

Total answers: 2

How to close a SQLAlchemy session?

How to close a SQLAlchemy session? Question: Following what we commented in How to close sqlalchemy connection in MySQL, I am checking the connections that SQLAlchemy creates into my database and I cannot manage to close them without exiting from Python. If I run this code in a python console, it keeps the session opened …

Total answers: 3

flask Set Cookie for every response

flask Set Cookie for every response Question: I use flask session in my app. In one of my handler I set session value and no session set in other handlers. But I found that in every response there is a http header: Set Cookie exists. Why does that happen? app = Flask(__name__) app.secret_key = r”A0Zr98j/3yX …

Total answers: 1

About refreshing objects in sqlalchemy session

About refreshing objects in sqlalchemy session Question: I am dealing with a doubt about sqlalchemy and objects refreshing! I am in the situation in what I have 2 sessions, and the same object has been queried in both sessions! For some particular thing I cannot to close one of the sessions. I have modified the …

Total answers: 7