You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in result/swagger_client/api_client.py file
in __deserialize_file method:
def__deserialize_file(self, response):
"""Deserializes body to file Saves response body into a file in a temporary folder, using the filename from the `Content-Disposition` header if provided. :param response: RESTResponse. :return: file path. """fd, path=tempfile.mkstemp(dir=self.configuration.temp_folder_path)
os.close(fd)
os.remove(path)
content_disposition=response.getheader("Content-Disposition")
ifcontent_disposition:
filename=re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
content_disposition).group(1)
path=os.path.join(os.path.dirname(path), filename)
withopen(path, "wb") asf:
f.write(response.data)
returnpath
Error in block with writing to file response.data has type "str" but file opened with "wb" mode, need be "w"
The text was updated successfully, but these errors were encountered:
goDeni
changed the title
[Python] on respose type "file", generated code got "str" type
[Python] response.data has type "str" but file opened with "wb" mode, need be "w"
Mar 24, 2021
Description
Swagger-codegen version
3.0.25
Swagger declaration file content or url
Command line used for generation
Steps to reproduce
Just execute command
Suggest a fix/enhancement
I'll try fix this
BUG
in
result/swagger_client/api_client.py
filein
__deserialize_file
method:Error in block with writing to file
response.data
has type "str" but file opened with "wb" mode, need be "w"The text was updated successfully, but these errors were encountered: