Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
No, not the kind you dunk in milk. Browser cookies are little bits of data that your browser lets sites store on your computer. We'll use them to store all of the user's choices for their bear. Let's see how to store information in a cookie for later retrieval.
The JSON library docs. 99% of the time, you won't need anything more than .loads()
and .dumps()
.
New Terms
Response: A response is the data that the server, Flask, sends back to the client.
make_response()
: This function generates the entire response object that'll be sent back to the client, but lets you store it in a variable for further manipulation.
response.set_cookie()
: Sets a cookie on the response object. Takes name for the cookie and a value.
json.dumps()
: This method turns a Python data structure (list, string, dictionary, etc) into a JSON string.
json.loads()
: This method turns a JSON string into a Python object.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up