login with python (2)

Paul Rubin phr-n2002b at NOSPAMnightsong.com
Sat Jul 13 08:24:40 EDT 2002


"Ralf Claus" <102030405 at gmx.net> writes:

> 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>
> 
> I need a way to login to my router using a python script (automatic login).
> I can't find a way to implement
> this code in a script. I need help, or a site with an example.......:-((

Try something like:

  import urllib

  target = 'http://192.168.2.1:/login.htm'
  args = urllib.urlencode((('password','yourpass'),
                           ('site, 'go')))
  np = urllib.urlopen(target,args)

etc.

See the urllib docs for more info.



More information about the Python-list mailing list