471,337 Members | 1,162 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

[2.5] Script to POST to web page with cookies?

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.
Jul 20 '07 #1
2 1755
Hello Gille,
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
...
http://wwwsearch.sourceforge.net/mechanize/

HTH,
--
Miki <mi*********@gmail.com>
http://pythonwise.blogspot.com

Jul 20 '07 #2
On Jul 19, 7:43 pm, Gilles Ganault <nos...@nospam.comwrote:
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/a...ookielib.shtml

Jul 20 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Wayne Smith | last post: by
4 posts views Thread by James Johnson | last post: by
reply views Thread by WIWA | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.