Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #request #post #json #headers
ADD COMMENT
Topic
Name
1+7 =