Created
January 6, 2020 12:09
-
-
Save posilva/1ab0e748e40b82acfd232b41f2b28e23 to your computer and use it in GitHub Desktop.
Python3 http request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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