Skip to content
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

[Python3] Binary decode fails #1445

Closed
POD666 opened this issue Nov 14, 2018 · 3 comments
Closed

[Python3] Binary decode fails #1445

POD666 opened this issue Nov 14, 2018 · 3 comments

Comments

@POD666
Copy link

POD666 commented Nov 14, 2018

Description

I'm using openapitools/openapi-generator-cli:v3.3.1 docker image to generate client from my swagger.yml

One of endpoints returns binary data and generated client fails with UnicodeDecodeError.

The problem is here. I don't need response to be decoded to string as it's binary file.

My workaround is to pass _preload_content=False to the api call and handle urllib response object by myself.

I can suggest to simply wrap .decode("utf-8") in try-except.

@wing328
Copy link
Member

wing328 commented Nov 20, 2018

@POD666 thanks for reporting the issue. Do you mind filing a PR with the suggested fix so that we can review more easily?

@POD666
Copy link
Author

POD666 commented Nov 27, 2018

Probably we should remove attempt to decode data at all as it's saved as binary any way.
Or try to decode elsewhere, e.g. here.

@spacether
Copy link
Contributor

Receiving binary data now works in the python client.
See our

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants