urllib and persistence

Mark Carter cartermark46 at ukmail.com
Tue Mar 25 14:40:35 CET 2003

> >   http://wwwsearch.sourceforge.net/ClientCookie/ may thus
> > prove of help.
> As will wget, if you want a non-python solution.

Alas, the site requires logging in, but not in a strict
account/password way - it wants
to know your surname, for example. So I don't think that wget will

I must admit that I'm a bit lacking in understanding how urllib2
and/or ClientCookie
are supposed to work. Does ClientCookie work with Internet Explorer
cookies, or not?

My problem is as follows:
If I use Internet Explorer, and type in the URL I'm interested in,
then I get the page.
It's obviously picking up a cookie that I've stored, and letting me
access the page.
However, if I use urlib() from python on the same URL, I get a page to
the effect
that I haven't logged in, and need to supply my name and a few other

So I somehow need to respond to that request in order to get the real
page I'm
interested in. I tried one of the ClientCookie examples, but it didn't
help. One of my main problems is a lack of understanding about the
basic concepts
of what's going on (OK, I understand what a Cookie is, but I don't
how the server is picking it up from Internet Explorer, and how I can
the behaviour in Python). I don't even mind hard-coding some of the
if it makes things easier.

More information about the Python-list mailing list