Skip to content

Instantly share code, notes, and snippets.

@hanksudo
Created March 25, 2011 08:44
Show Gist options
  • Save hanksudo/886556 to your computer and use it in GitHub Desktop.
Save hanksudo/886556 to your computer and use it in GitHub Desktop.
urllib POST data
import urllib2, urllib
base_url = 'http://login.domain.com'
params = {'username':'hank',
'password':'hank',
}
data = urllib.urlencode(params)
req = urllib2.Request(base_url, data)
response = urllib2.urlopen(req)
print response.read()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment