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
"""Raise an error if the 'Content-Length' header does not match sent bytes. | |
Requests 2 doesn't raise an error if the value in the 'Content-Length' header | |
doesn't match the number of bytes actually received. This has been addressed in | |
requests 3 but the following is handy in the meantime. | |
https://github.com/psf/requests/pull/3563 | |
https://github.com/psf/requests/issues/4956 | |
""" | |
from requests.exceptions import HTTPError |
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
import zipfile | |
import zipfile_aes | |
secret_password = b'lost art of keeping a secret' | |
with zipfile_aes.AESZipFile('new_test.zip', | |
'w', | |
compression=zipfile.ZIP_LZMA, | |
encryption=zipfile_aes.WZ_AES) as zf: | |
zf.setpassword(secret_password) |