This commit is contained in:
parent
ec9509e5ea
commit
a6d90967c1
2 changed files with 2 additions and 3 deletions
|
@ -68,8 +68,7 @@ class RestAdapter:
|
||||||
if response.headers.get('Content-Type') == 'application/octet-stream':
|
if response.headers.get('Content-Type') == 'application/octet-stream':
|
||||||
# If the response contains a valid file, return success Result with file content
|
# If the response contains a valid file, return success Result with file content
|
||||||
return Result(success=True, status_code=response.status_code, message=response.reason, data=response.content)
|
return Result(success=True, status_code=response.status_code, message=response.reason, data=response.content)
|
||||||
else:
|
raise PyZiplineError("Could not decode response from Zipline server") from e
|
||||||
raise PyZiplineError("Could not decode response from Zipline server") from e
|
|
||||||
|
|
||||||
# If status_code in 200-299 range, return success Result with data, otherwise return failed Result with message
|
# If status_code in 200-299 range, return success Result with data, otherwise return failed Result with message
|
||||||
is_success = 299 >= response.status_code >= 200
|
is_success = 299 >= response.status_code >= 200
|
||||||
|
|
|
@ -272,7 +272,7 @@ class ZiplineApi:
|
||||||
Returns:
|
Returns:
|
||||||
bytes: The file, in bytes
|
bytes: The file, in bytes
|
||||||
"""
|
"""
|
||||||
result: Result = self._rest_adapter.get(endpoint=f"auth/image", params={'id': file_id, 'password': password})
|
result: Result = self._rest_adapter.get(endpoint="auth/image", params={'id': file_id, 'password': password})
|
||||||
if result.status_code == 200:
|
if result.status_code == 200:
|
||||||
return result.data
|
return result.data
|
||||||
if result.message == 'image not found':
|
if result.message == 'image not found':
|
||||||
|
|
Loading…
Reference in a new issue