Skip to Content
Cloud Native Python
book

Cloud Native Python

by Manish Sethi
July 2017
Intermediate to advanced
374 pages
8h
English
Packt Publishing
Content preview from Cloud Native Python

Cookies

Cookies are similar to sessions, other than the fact that they are maintained on the client computer in the form of a text file; whereas, sessions are maintained on the server side.

Their main purpose is to keep track of the client's usage and, based on their activity, improve the experience by understanding the cookies.

The cookies attribute is stored in the response object, which is a collection of key-value pairs that have cookies, variables, and their respective values.

We can set the cookies using the set_cookie() function of the response object to store a cookie as follows:

 @app.route('/set_cookie') def cookie_insertion(): redirect_to_main = redirect('/') response = current_app.make_response(redirect_to_main ) response.set_cookie('cookie_name',value='values') ...
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

Python for DevOps

Python for DevOps

Noah Gift, Kennedy Behrman, Alfredo Deza, Grig Gheorghiu
Cloud Native

Cloud Native

Boris Scholl, Trent Swanson, Peter Jausovec

Publisher Resources

ISBN: 9781787129313Supplemental Content