Skip to content

Instantly share code, notes, and snippets.

@posilva
Created January 6, 2020 12:09
Show Gist options
  • Save posilva/1ab0e748e40b82acfd232b41f2b28e23 to your computer and use it in GitHub Desktop.
Save posilva/1ab0e748e40b82acfd232b41f2b28e23 to your computer and use it in GitHub Desktop.
Python3 http request
from urllib import request, parse
# some json data
data = parse.urlencode({'secret':'a', 'response':'b'}).encode()
req = request.Request("https://www.google.com/", data=data) # this will make the method "POST"
resp = request.urlopen(req)
print(resp.read())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment