Skip to content

Instantly share code, notes, and snippets.

@klingerko
Created May 1, 2020 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klingerko/1d2efc23d0dc3244a4dd2365a827e858 to your computer and use it in GitHub Desktop.
Save klingerko/1d2efc23d0dc3244a4dd2365a827e858 to your computer and use it in GitHub Desktop.
gzip decompress
# ...
response = requests.get(api_url, headers=headers)
if not response or response.status_code != 200:
return None
# we have the file as gzip in response.content
# we decompress it and store it on disk
with open(f"{hash_}.bin", 'wb') as tmp_file:
tmp_file.write(zlib.decompress(response.content, 16+zlib.MAX_WBITS))
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment