Skip to content

Instantly share code, notes, and snippets.

@rishi93
Created February 22, 2016 09:26
Show Gist options
  • Save rishi93/a2030effddbdf398e89e to your computer and use it in GitHub Desktop.
Save rishi93/a2030effddbdf398e89e to your computer and use it in GitHub Desktop.
POSTing and GETing in Python
#from urllib import urlopen
#url = "https://api.thingspeak.com/update?api_key=SR5SPU47GKH6MXT9&field1=17235"
#response = urlopen(url).read()
#print response
import urllib2
import urllib
query_args = { 'name':'Active','phone':'Active','address':'from python' }
url = 'http://www.oldthrow.com/mySubmit.php'
data = urllib.urlencode(query_args)
request = urllib2.Request(url, data)
response = urllib2.urlopen(request).read()
print response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment