it is contained in http headersnot in page' html moreovercookie data can be stored permanently on the clientand so it outlives both pages and interactive sessions for web application developerspython' standard library includes tools that simplify the task of sending and receivinghttp cookiejar does cookie handling for http clients that talk to web serversand the module http cookies simplifies the task of creating and receiving cookies in server-side scripts moreoverthe module urllib request we've studied earlier has support for opening urls with automatic cookie handling creating cookie web browsers such as firefox and internet explorer generally handle the client side of this protocolstoring and sending cookie data for the purpose of this we are mainly interested in cookie processing on the server cookies are created by sending special http headers at the start of the reply streamcontent-typetext/html set-cookiefoo=barthe full format of cookie' header is as followsset-cookiename=valueexpires=datepath=pathnamedomain=domainnamesecure the domain defaults to the hostname of the server that set the cookieand the path defaults to the path of the document or script that set the cookie--these are later matched by the client to know when to send cookie' value back to the server in pythoncookie creation is simplethe following in cgi script stores last-visited time cookieimport http cookiestime cook http cookies simplecookie(cook['visited'str(time time()print(cook output()print('content-typetext/html\ ' dictionary prints "set-cookievisited= the simplecookie call here creates dictionary-like cookie object whose keys are strings (the names of the cookies)and whose values are "morselobjects (describing the cookie' valuemorsels in turn are also dictionary-like objects with one key per cookie propertypath and domainexpires to give the cookie an expiration date (the default is the duration of the browser session)and so on morsels also have attributes--for instancekey and value give the name and value of the cookierespectively assigning string to cookie key automatically creates morsel from the stringand the cookie object' output method returns string suitable for use as an http headerprinting the object directly has the same effectdue to its __str__ operator overloading here is more comprehensive example of the interface in actionimport http cookiestime cooks http cookies simplecookie( server-side scripting