I am learning how to login to a site using python via site and apply it on my site. So that I can open the web page without any login requirements. It does not show any errors, but I can not do what I want. Let the way that I do it is not a way to do it, and then please answer how to achieve it. I want to log in through the credentials that I gave, and then open the browser. However, when the page loads, it is still not logged in. Hope what I meant was clear. Please ask me if my question is cleared. We will be very grateful. Thanks!
I changed the goal a bit:
import urllib, urllib2, cookielib
import webbrowser
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders.append(('User-agent', 'Mozilla/4.0'))
opener.addheaders.append( ('Referer', 'http://somesite.com/adminpanel/index.php') )
login_data = urllib.urlencode({'admin_userid' : 'admin',
'admin_password' : 'test',
'login' : 'Login'
})
resp = opener.open('http://somesite.com/adminpanel/index.php', login_data)
webbrowser.open('http://somesite.com/adminpanel/index.php')
resp.close()