faqts : Computers : Programming : Languages : Python : Common Problems : Web Programming

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

8 of 11 people (73%) answered Yes
Recently 6 of 8 people (75%) answered Yes

Entry

How can I duplicate the action of a browser POSTing form data to a server?

Jun 13th, 2000 04:39
unknown unknown, Cliff Crawford


urlopen() takes an optional second argument, which is the data to post.
For example:

urlopen("http://example.org/test.cgi", urlencode({name: "Cliff", id:
"4"})

Also, you might want to take a look at the library reference for urllib:
<http://www.python.org/doc/current/lib/module-urllib.html>