spis2022.github.io

FOCS 08/22/2022 Web Apps Part 2

Sessions

Web applications, by nature are “stateless”.

Each request and response is separate.

However, we can use some “tricks” to create what is called a “session”.

According to this link:

In order to store data across multiple requests, Flask utilizes cryptographically-signed cookies (stored on the web browser) to store the data for a session. This cookie is sent with each request to the Flask app on the server-side where it’s decoded.

Since session data is stored in cookies that are cryptographically-signed (not encrypted!), sessions should NOT be used for storing any sensitive information. You should never include passwords or personal information in session data.

Here’s an example of a Flask web app that uses a session:

https://replit.com/@phtcon/IroncladExternalQuotient#main.py

Further Reading About Sessions

Getting Data from APIs

https://www.nylas.com/blog/use-python-requests-module-rest-apis/