Getting and Setting Cookies

John J. Lee jjlee at reportlab.com
Tue Jul 18 19:05:50 EDT 2006


"Vlad Dogaru" <ddvlad at gmail.com> writes:

> I am trying to use cookies and Python to create a simple login example.
> But I am very disoriented at the existence of two cookie libraries,
> namely Cookie and cookielib. I have seen examples of setting cookies
[...]

>From the cookielib docs:

http://docs.python.org/lib/module-cookielib.html

| The cookielib module defines classes for automatic handling of HTTP
| cookies. It is useful for accessing web sites that require small
| pieces of data - cookies - to be set on the client machine by an HTTP
| response from a web server, and then returned to the server in later
| HTTP requests.

(note the *accessing* there)

[...]

| Module Cookie: HTTP cookie classes, principally useful for server-side
|     code. The cookielib and Cookie modules do not depend on each
|     other.


Module cookielib is for web client code (writing code that works like
a browser).  Module Cookie is for server-side code (writing code to
make a web site work).  You don't make it entirely clear which you're
doing, but it sounds like the latter.


John



More information about the Python-list mailing list