New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The code in the document does not work #2069
Comments
Thanks for raising this @imsgj - you're absolutely correct. We made a change here so that only binary content is accepted. However I'm not sure we really want to do that or not. The necessary case was that we only accept files opened in binary mode. But we could still accept the plain ol' We've got two options here.
|
If we decide to keep the behavior -- should we also try to sniff "have we got str content?" early on enough so that we display a friendlier error message, also explaining why we only accept |
FWIW I am hopeful that we can allow non-files for two reasons:
|
You can use : payload = (
('foo', (None, b'bar')),
('variable', (None, str.encode(variable))),
('bar', (None, b'foo')),
)
client.post("https://.../api/post", headers=headers, files=payload) This will work. The other problem that I have is that we are not able to set a "WebKitFormBoundary" for the form, this could be really useful because almost every website using multipart are using a boundary |
Hi. The code in the document does not work
The error is
I found this problem has been raised but not solved
If the string is modified with b, it works fine
Compared to requests
The text was updated successfully, but these errors were encountered: