File: simple.py

package info (click to toggle)
python-clientform 0.2.2-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 528 kB
  • ctags: 467
  • sloc: python: 4,419; makefile: 61
file content (14 lines) | stat: -rwxr-xr-x 427 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env python

from urllib2 import urlopen
from ClientForm import ParseResponse

response = urlopen("http://wwwsearch.sourceforge.net/ClientForm/example.html")
forms = ParseResponse(response, backwards_compat=False)
form = forms[0]
print form
form["comments"] = "Thanks, Gisle"

# form.click() returns a urllib2.Request object
# (see HTMLForm.click.__doc__ if you don't have urllib2)
print urlopen(form.click()).read()