Created
August 24, 2019 14:10
-
-
Save claudiobusatto/747ef5b0e47978a5505ee2fa30636c7e to your computer and use it in GitHub Desktop.
POST request with JSON body in Python using requests library
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
import requests | |
import json | |
url = "http://localhost:8080" | |
data = {'key': 'value'} | |
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} | |
r = requests.post(url, data=json.dumps(data), headers=headers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment