Skip to content

UnicodeDecodeError when calling get_data_file in DataApi #7

@AT-SyT

Description

@AT-SyT

Hi there,

I tried using the client tools for downloading images from PHIS via the API and stumbled upon the following error in the client tools.
The generated client tries to decode the response from the server with UTF-8 which obviously does not work for a png file.
Which leads to the following error:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

This happens in rest.py on line 222

# In the python 3, the response.data is bytes.
# we need to decode it to string.
if six.PY3:
    r.data = r.data.decode('utf8')

The issue is also mentioned in the swagger-codegen repo: swagger-api/swagger-codegen-generators#931

and seems to be fixed via: swagger-api/swagger-codegen-generators#932

I don't know which version of codegen is used for this tool, but it seems to be one before the fix was merged.

Is it possible to generate the client with a newer version of codegen or where there some breaking changes that are in the way for bumping up the codegen version?

Best regards,
Sebastian

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions