Send POST Request using Python

urllib.request library

from urllib import request

data = 'name=John&age=20'

req = request.Request('https://httpbin.org/post', data.encode('utf-8'))
response = request.urlopen(req)
content = response.read().decode('utf-8')

print(content)

Leave a Comment

Cancel reply

Your email address will not be published.