Created
June 20, 2014 20:13
-
-
Save filipecifali/e98394a19aba7eaf343c to your computer and use it in GitHub Desktop.
login urllib2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
base_url = 'http://gendou.com/' | |
username = '********' # derp dy | |
password = '********' # herp | |
def login(): | |
cj = cookielib.CookieJar() | |
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) | |
urllib2.install_opener(opener) | |
login_data = urllib.urlencode({'name':username, 'pass':password}) | |
request = urllib2.Request(base_url+'/forum/login.php', login_data) | |
response = urllib2.urlopen(request).read() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment