login with python (2)

Ralf Claus 102030405 at gmx.net
Sat Jul 13 08:54:27 EDT 2002


"Fredrik Lundh" <fredrik at pythonware.com> schrieb im Newsbeitrag
news:LWUX8.15865> something like this could work (untested):
>
>     import urllib
>
>     LOGIN = "http://192.168.2.1:/login.htm"
>
>     SITE = "go"
>     PASSWORD = "..."
>
>     data = urllib.urlencode({"site": SITE, "password": PASSWORD})
>     file = urllib.urlopen(LOGIN, data)
>
>     print file.headers
>     print file.read()
>
> study the headers and the page contents carefully to see what
> you need to do next (the site may be forwarding you somewhere,
> possibly using javascript; it may use cookies, etc)

Hello,
next to do is to type in the password :(

print file.read()  is the content of the login page......

thx for your ideas






More information about the Python-list mailing list