Error in httpx.post() for application/json #1900
Unanswered
DDaamm
asked this question in
Potential Issue
Replies: 1 comment 3 replies
-
Could you describe what the issue is that you're seeing? Is an exception being raised? Is the response being returned okay, and what status code are you seeing? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all! I have a problem in using new versions of httpx.
Recently I tried to update httpx package to 0.19 and 0.20 but, for both versions I face an issue in sending .json files through httpx.post() function. No changes were made inside my original code. This problem does not exist for version 0.18 (which I am actually using).
The code is pretty simple:
These are, respectively, the definition of File type:
and the definition of AddDocumentsMultipartData class:
When I run the script an error is rised: "TypeError: Expected bytes or bytes-like object got: <class 'str'>".
Here is the output:
Am I doing something wrong or something is changed from 0.18 to 0.19 in the way the package is handling POST requests?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions