#!/usr/bin/env python
import Cookie
c1 = Cookie.SimpleCookie()
# Create a cookie in c1
# This will be temporary and will disappear when the session is closed
c1["cracker"] = "hello"
# The RFC says you should always set this but it seems to work ok without it
c1["cracker"]["version"] = 1
# Create another one
c1["bisquit"] = "whatever"
# Make the browser store it for one hour
c1["bisquit"]["max-age"] = 3600 # Time to keep, in seconds
c1["bisquit"]["expires"] = 3600 # Obsolete, but Netscape still seems to require it
c1["bisquit"]["version"] = 1
# Print the headers that sets the cookies
Recent comments