Skip to content

Instantly share code, notes, and snippets.

@hanksudo
Created March 25, 2011 08:44
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 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