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

download gives gzipped result #175

Closed
soxofaan opened this issue Jan 29, 2021 · 1 comment
Closed

download gives gzipped result #175

soxofaan opened this issue Jan 29, 2021 · 1 comment

Comments

@soxofaan
Copy link
Member

cube.download("cube.tiff", format="GTiff") or ts.download("cube.json", format="JSON") sometimes gives a result that is gzipped and needs manual un-gzipping before it is an actual tiff or json file.

@soxofaan
Copy link
Member Author

soxofaan commented Jan 29, 2021

https://2.python-requests.org/en/master/user/quickstart/#raw-response-content

Apparently we should not use .raw, but something like .iter_content so that Content-Encoding is taken into account:

r = self.post(path="/result", json=request, stream=True, timeout=1000)
if outputfile is not None:
with Path(outputfile).open(mode="wb") as f:
shutil.copyfileobj(r.raw, f)

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

No branches or pull requests

1 participant