log in to a website

Jeff Epler jepler at unpythonic.net
Thu Jun 16 15:20:01 EDT 2005


You may find the third-party modules "ClientForm" and "ClientCookie" to
be useful.

Using ClientForm, the following code uploads a file to a particular web form:
    forms = ClientForm.ParseResponse(urllib2.urlopen(url))
    f = forms[0]
    f.add_file(open(local, "rb"), filename=remote, name="file")
    u = f.click("attach")
    urllib2.urlopen(u)

A web search should turn up the homepage for these modules.

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050616/fc38cbff/attachment.sig>


More information about the Python-list mailing list