3

As httpx aims to be compatible with the requests API wherever possible i tried the following based on this answer:

with open(local_file, 'rb') as f:
    response = httpx.put(s3_presigned_url, data=f)

This returns a 501 response from S3 with the following message:

<?xml version="1.0" encoding="UTF-8"?>
    <Error><Code>NotImplemented</Code><Message>A header you provided implies functionality that is not implemented</Message><Header>Transfer-Encoding</Header><RequestId>AA70B8C6566230A7</RequestId><HostId>lU1m+ZF48KN8jV+F4bPjMU+81zBNRIt9TdaWzXaNZJD4HCqcDzAzGNli+g7/Z9XhnPjOzFdMFio=</HostId></Error>

I have confirmed that the equivalent requests call works.

I am on Windows 10 using Python version 3.7.7 and httpx version 0.14.2.

agrav
  • 31
  • 5
  • The error message tells you exactly what's wrong -- httpx is adding a header (`Transfer-Encoding`) which the server doesn't recognize. Presumably `requests` doesn't add that header unless it's explicitly asked for. If you consider that undesirable behavior, the place to go is presumably the `httpx` project. – Charles Duffy Aug 31 '20 at 15:09
  • ...you could also file a bug report with S3 asking that they add support for the header in question. – Charles Duffy Aug 31 '20 at 15:12
  • Thanks for your comments. Yes I understood that hte problem was with the header. My hope was that someone could offer an alternative usage of _httpx.put_ to omit the header in question. As you say, The httpx project may be a better place for this question. – agrav Sep 01 '20 at 05:47

0 Answers0