Skip to content

Instantly share code, notes, and snippets.

@filipecifali
Created June 20, 2014 20:13
Show Gist options
  • Save filipecifali/e98394a19aba7eaf343c to your computer and use it in GitHub Desktop.
Save filipecifali/e98394a19aba7eaf343c to your computer and use it in GitHub Desktop.
login urllib2
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