diff options
| author | Adam Janovsky | 2020-11-25 15:46:59 +0100 |
|---|---|---|
| committer | Adam Janovsky | 2020-11-25 15:46:59 +0100 |
| commit | d4cf3bf8b2329181d0f5bf17c3dd87564fa80b2a (patch) | |
| tree | ea6951d3ce518651264a3b6c017d3fad5201b53b /sec_certs | |
| parent | a0c8ce2bd6c27b805ab037f3637322c1324709a0 (diff) | |
| download | sec-certs-d4cf3bf8b2329181d0f5bf17c3dd87564fa80b2a.tar.gz sec-certs-d4cf3bf8b2329181d0f5bf17c3dd87564fa80b2a.tar.zst sec-certs-d4cf3bf8b2329181d0f5bf17c3dd87564fa80b2a.zip | |
Test for download of pdf files
The test assumes that the files download correctly.
Diffstat (limited to 'sec_certs')
| -rw-r--r-- | sec_certs/helpers.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sec_certs/helpers.py b/sec_certs/helpers.py index 7db64f55..718b66cd 100644 --- a/sec_certs/helpers.py +++ b/sec_certs/helpers.py @@ -45,6 +45,14 @@ def get_first_16_bytes_sha256(string: str) -> str: return hashlib.sha256(string.encode('utf-8')).hexdigest()[:16] +def get_sha256_filepath(filepath): + hash_sha256 = hashlib.sha256() + with open(filepath, "rb") as f: + for chunk in iter(lambda: f.read(4096), b''): + hash_sha256.update(chunk) + return hash_sha256.hexdigest() + + def sanitize_link(record: str) -> Union[str, None]: if not record: return None |
