HTTPS Login

Tom Grove thomas.grove at nepinc.com
Thu Aug 31 11:48:27 EDT 2006


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