Web authentication urllib2

Gabriel dunmer at dreams.sk
Sat Jan 24 13:23:20 CET 2009

Yep, i realize this a minute after posting, sorry.

And thank you again .)

Steve Holden wrote:
> 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

More information about the Python-list mailing list