Created
May 1, 2020 13:21
-
-
Save klingerko/1d2efc23d0dc3244a4dd2365a827e858 to your computer and use it in GitHub Desktop.
gzip decompress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... | |
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