Getting and Setting Cookies

Vlad Dogaru ddvlad at gmail.com
Wed Jul 19 05:25:46 EDT 2006


John J. Lee wrote:
> "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.

I am trying to write a simple login script. I understand (or rather I
think I understand) how to set a cookie with the Cookie module. My
problem is getting the cookies that are currently set. How can I do
that?




More information about the Python-list mailing list