I am trying to submit this web form and log in to this site:
https://www.kalahari.net/profile/pipeline/signin.aspx
I keep getting the source code of the login site as output when the script is executed, so everything seems to work (no errors), but it just is not logged in. I cannot find what I am doing wrong. Please help. I am using Python 3.1.2, I cannot use Mechanize since the code must be written in Python 3.x
I think my problem might be the POST URL. I am sending login information, but I can’t understand what it is.
f=open("page_src.html",'wb')
cj=cookiejar.CookieJar()
params=urllib.parse.urlencode({'ctl00$ctl00$cplhMain$cplhContent$txtEmail': 'username', 'ctl00$ctl00$cplhMain$cplhContent$txtPassword': 'pass'})
opener = req.build_opener(req.HTTPCookieProcessor(cj))
opener = urllib.request.FancyURLopener()
page = opener.open("https://www.kalahari.net/profile/pipeline/signin.aspx", params)
profilepage = opener.open("https://www.kalahari.net/profile/pipeline/profile.aspx")
source=profilepage.read()
f.write(source)
f.close()
source
share