login with python (2)
Fredrik Lundh
fredrik at pythonware.com
Sat Jul 13 08:20:59 EDT 2002
More information about the Python-list mailing list
Sat Jul 13 08:20:59 EDT 2002
- Previous message (by thread): login with python (2)
- Next message (by thread): login with python (2)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ralf Claus wrote: > Hello, the login website of my router needs the following > html code to login: > > <form action="http://192.168.2.1:/login.htm" method="post" name="aa"> > <INPUT type="password" maxLength=4 size=6 name=pass></td><p> > <input type="hidden" name="site" value="go"> > </form> 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) </F> <!-- (the eff-bot guide to) the python standard library: http://www.pythonware.com/people/fredrik/librarybook.htm -->
- Previous message (by thread): login with python (2)
- Next message (by thread): login with python (2)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list