I'm trying to upload a file using httpx. This is my script:
import httpx
headers = { 'action': 'upload' }
file = 'filename.zip'
auth = httpx.DigestAuth('user', 'password')
files = {'upload-file': open('files/' + file, 'rb')}
with httpx.Client() as client:
r = httpx.post('http://192.168.10.10/upload', files=files, auth=auth, headers=headers)
The file is 70Mb and the script fails before the request sent the full 70MB with
httpcore.WriteError: [Errno 32] Broken pipe
If I remove the auth=auth
the http requests sends the full 70MB and the request completes with a 401 status.
A request such as this one is successful:
r = httpx.get('http://192.168.10.10/index.html', auth=auth)
Why would the authentication somehow lead to the upload failing?