HTTPS Login

Thierry Lam lamthierry at gmail.com
Thu Aug 31 16:38:32 EDT 2006


Instead of using the following:

> req = urllib2.Request("https://web.site.com/default.aspx", params)
> data = urllib2.urlopen(req)


Try:

data = urllib.urlopen("https://web.site.com/default.aspx", param)

Thierry

Tom Grove wrote:
> I am trying to login to a secure website and I am having some difficulty
> understanding the process.  Here is what I have with my limited
> knowledge of the subject:
>
> ##Start Code##
> #!/usr/bin/env
> python
>
>
>
> import
> urllib
>
> import
> urllib2
>
>
>
> #
> Main
>
> params =
> urllib.urlencode({
>
>     "user" :
> "username",
>
>     "pass" :
> "password"
>
> })
>
>
>
> req = urllib2.Request("https://web.site.com/default.aspx",
> params)
> data =
> urllib2.urlopen(req)
>
>
>
> for line in
> data.readlines():
>
>     print line
> ##End Code##
>
> This just doesn't seem to work.  It just brings me back to a login screen.
> 
> If you can lend a hand it would be much appreciated.
> 
> -Tom




More information about the Python-list mailing list