Skip to content

Instantly share code, notes, and snippets.

@fedmich
Created April 20, 2012 07:50
Show Gist options
  • Save fedmich/2426974 to your computer and use it in GitHub Desktop.
Save fedmich/2426974 to your computer and use it in GitHub Desktop.
Python codes
import httplib, urllib
params = urllib.urlencode({
'param': 'value',
'param2': 'value2'
})
headers = {
"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"
}
conn = httplib.HTTPConnection("localhost:80")
conn.request("POST", "/post/", params, headers)
response = conn.getresponse()
print response.status, response.reason
data = response.read()
conn.close()
print data
#USER AGENT here is blank, Not set
python setup.py install
python setup.py install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment