Answers for "python request post with json with headers"

0

python request post with json with headers

url = "http://localhost:8080"
data = {'sender': 'Alice', 'receiver': 'Bob', 'message': 'We did it!'}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post(url, data=json.dumps(data), headers=headers)
Posted by: Guest on August-17-2021

Code answers related to "python request post with json with headers"

Python Answers by Framework

Browse Popular Code Answers by Language