JSON Body Wrong Type
JSON body wrong type
$ python -c "import requests; requests.post('https://api.example.com', json='{"x":1}')"
# Sent as a JSON string; server may double-parse or error
Why this happens
json= expects Python objects (dict/list). Passing a pre-encoded string results in wrong double-encoding.
Fix
Use json= with dicts; use data= for form bodies.
Wrong code
import requests
requests.post('https://api.example.com', json='{"x":1}')
Fixed code
import requests
requests.post('https://api.example.com', json={'x':1}, timeout=10)