I am trying to script a HTTP POST request with python. When trying it with curl from bash, everything is working. With python, using either the requests or the urllib3-library, I am getting an error response from the API. The POST request contains information in headers and as json in the request body. What I noticed, when I intercept the packets with Wireshark, the curl-request (which is working) is one single packet of length 374 bytes. The python-request (no difference between requests and urllib3 here) is splitted into 2 separate packets of 253 and 144 bytes length. Wireshark reassembles these without problems and they both seem to contain the complete information in header and POST body. But the API I am trying to connect to answers with a not very helpful "Error when processing request". As the 253 bytes can't be the limit of a TCP-packet, what is the reason for that behavior? Is there a way to fix that? EDIT: bash: curl 'http://localhost/test.php' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36' -H 'Content-Type: application/json' -d '{"key1":"value1","key2":"value2","key3":"value3"}' python: import requests, json headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36", "Content-Type": "application/json"} data = {"key1":"value1", "key2":"value2", "key3":"value3"} r=requests.post("http://localhost/test.php", headers=headers, data=json.dumps(data)) Continue reading...