In the lastest requests package, you can use json
parameter in requests.post()
method to send a json dict, and the Content-Type
in header will be set to application/json
. There is no need to specify header explicitly.
import requests
payload = {'key': 'value'}
requests.post(url, json=payload)