[Tutor] formClient or how to login to a web site?

kbond kbond at free.fr
Thu Nov 4 04:50:26 CET 2004


Hello all of you,

I am starting a project that has a simple objectif logon into a web site 
(https://interactif.creditlyonnais.fr/), access a protected area and 
then save a web page on my computer.
The idea is to be able to do this daily and then process the files 
collection to do some statistic.

After googling, I found out that there is a python module called: 
clientForm (http://wwwsearch.sourceforge.net/ClientForm/)
here it is what the author wrote about it:"ClientForm is a Python module 
for handling HTML forms on the client side, useful for parsing HTML 
forms, filling them in and returning the completed forms to the server. "

The problem is that I am not able to validate my form and send it back 
to the server. My goal is then to be able to get the following web page.

you will find below my code :
+++++++++++++++++++++++++++
import urllib2
from urllib2 import urlopen
from ClientForm import ParseResponse
forms = ParseResponse(urlopen("https://interactif.creditlyonnais.fr"))
form = forms[0]
print form

form["agenceId"]="XXXXX"
form["compteId"]="XXXXXX"
form["CodeId"]="XXXXX"

print form
request= form.click() ##My guess is that I am missing something there
print request
response= urlopen(request)
print response.geturl() ##Unfortunatly I am getting there the original URL.
print response.read()
response.close()
+++++++++++++++++++++++++++

Any help with clientForm or another solution would be more than welcome.

Thank you for your help


More information about the Tutor mailing list