Web authentication urllib2

Steve Holden steve at holdenweb.com
Sat Jan 24 07:18:58 EST 2009


Gabriel wrote:
> First, thank you both
> 
> I think this isn't basic auth, because this page has form login.
> I read site's html source and used wireshark to analyze communication
> between my browser and website and i really find out that a was ignoring
> one field
> 
> I added it to the parameters but it didn't help..
> Maybe i'm still missing something
> 
> Here's the post packet:
> http://student.fiit.stuba.sk/~sevecek06/auth.txt
> 
> and here's the code again, with little change and real web location added:
> 
>     opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
>     urllib2.install_opener(opener)
> 
>     params = urllib.urlencode(dict(login='login', pwd='pass', page=''))
>     f = opener.open('https://www.orangeportal.sk/', params)
>     data = f.read()
>     f.close()
> 
If you look at the login form on the home page of that portal you will see

<form name="form_login" action="/portal/do_login.dwp" method="POST">

This means that the form should be submitted to

  https://www.orangeportal.sk/portal/do_login.dwp

Some forms submit to the same URL that contain them, but many don't.
This is one of the ones that requires submission to a different URL!

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list