When uploading you need to add the file itself and the headers:
>>> response = requests.post(url=uploadPolicy+fileName,verify=False,auth=("admin","admin"),data=open('test.xml', 'rb'),headers={'Content-Type': 'application/octet-stream', 'Content-Range': '0-402287/402288'})
>>>
>>> response.status_code
200
>>>
>>> print(response)
>>>
>>> response.content
b'{"remainingByteCount":0,"usedChunks":{"0":402288},"totalByteCount":402288,"localFilePath":"/ts/var/rest/admin~test.xml","temporaryFilePath":"/ts/var/rest/tmp/admin~test.xml","generation":0,"lastUpdateMicros":1543445350182166}'
Or using curl:
curl -sku admin:admin -X POST https://155.140.lab.es.f5net.com/mgmt/tm/asm/file-transfer/uploads/test.xml -H "Content-Type: application/octet-stream" -H "Content-Range: 0-402287/402288" --data-binary "@test.xml" | jq .
{
"remainingByteCount": 0,
"usedChunks": {
"0": 402288
},
"totalByteCount": 402288,
"localFilePath": "/ts/var/rest/admin~test.xml",
"temporaryFilePath": "/ts/var/rest/tmp/admin~test.xml",
"generation": 0,
"lastUpdateMicros": 1543445684953045
}