Skip to Content
Building Web Applications with Flask
book

Building Web Applications with Flask

by Italo Maia
June 2015
Intermediate to advanced
160 pages
3h 22m
English
Packt Publishing
Content preview from Building Web Applications with Flask

Sessions or storing user data between requests

Sometimes you'll have a scenario in your application where data has to be kept between requests, but there is no need to persist it in the database, like an authentication token that identifies a logged user or which items a user added to his shopping cart. At those times of peril, use Flask sessions.

Flask sessions are a solution for transient storage between requests implemented using browser cookies and cryptography. Flask uses the secret key value to encrypt any values you set in the session before setting it in the cookies; this way, even if a malicious person has access to the victim's browser, it won't be possible to read the cookie's content.

Tip

Because the secret key is used to encrypt the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Building RESTful Python Web Services

Building RESTful Python Web Services

Gastón C. Hillar

Publisher Resources

ISBN: 9781784396152Supplemental Content