Skip to content

Instantly share code, notes, and snippets.

@askielboe
Created December 7, 2009 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save askielboe/251038 to your computer and use it in GitHub Desktop.
Save askielboe/251038 to your computer and use it in GitHub Desktop.
import cookielib
import urllib
import urllib2
cookies = cookielib.LWPCookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies))
urllib2.install_opener(opener)
url = 'http://peppeshus.dk/forum/ucp.php?mode=login'
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
values = {'username' : 'peppeswave',
'password' : 'PASSWORD'}
headers = { 'User-Agent' : user_agent }
data = urllib.urlencode(values)
req = urllib2.Request(url, data, headers)
response = urllib2.urlopen(req)
the_page = response.read()
print the_page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment