Script to POST to web page with cookies?

7stud bbxx789_05ss at yahoo.com
Fri Jul 20 09:30:43 CEST 2007


On Jul 19, 7:43 pm, Gilles Ganault <nos... at nospam.com> wrote:
> Hello
>
> I need to write a script to automate fetching data from a web site:
> 1. using the POST method, log on, with login/password saved as cookies
> 2. download page and extract relevent information using regexes
> 3. log off
> 4. wait for a random number of minutes, and GOTO 1
>
> I'm a bit confused with how to get POST and cookies in the same
> script:
> - urllib vs urllib2 vs httplib?
> - "ClientCookie.urlopen("www") behaves identically to urllib2.urlopen,
> except that it deals with cookies automatically"
>
> Has anyone some working code that I could borrow (er... steal) to do
> this?
>
> Thank you.

Also, see here:

http://www.voidspace.org.uk/python/articles/cookielib.shtml




More information about the Python-list mailing list