How to share session with IE

John J. Lee jjl at pobox.com
Sat Oct 14 17:03:19 CEST 2006


"zdp" <zhaodapu at gmail.com> writes:
[...]
> 1. Use the cookie of IE, so I don't need to code to logon. That means I
> must use ClientCookie. I found some example in the docs and the
> newsgroup. Below is some code based on the docs of ClientCookie. But
> the page I get is still the page told me must login ( I CAN get the
> right page in IE).

Try mechanize (same website as ClientCookie -- though right now, that
part of sourceforge seems to be down for me).  It supports more
browser features automatically.

[...]
> However, both ways didn't work for me. I don't know what's wrong. If
> it's because the server page check the header or the submit of the form
> is wrong?

Changing the HTTP headers you send may solve your problem, yes.
Either that, or the response body ;-)


> I didn't study Mechanize module yet. I want a solution as simple as
> possible for distribution reason.

OK, then you should compare the HTTP requests that a real browser
sends with the HTTP requests that your Python script sends.  The
following pages give some help with that (from memory, since the site
is down right now):

http://wwwsearch.sf.net/mechanize/doc.html#debugging

http://wwwsearch.sf.net/bits/GeneralFAQ.html


John



More information about the Python-list mailing list