Function
extract_s3_bucket
(bucket, key, destination_directory)
Source from the content-addressed store, hash-verified
| 13 | |
| 14 | |
| 15 | def extract_s3_bucket(bucket, key, destination_directory): |
| 16 | obj = bucket.Object(key) |
| 17 | try: |
| 18 | with io.BytesIO(obj.get()["Body"].read()) as tf: |
| 19 | tf.seek(0) |
| 20 | with zipfile.ZipFile(tf, mode='r') as zipf: |
| 21 | zipf.extractall(path=destination_directory) |
| 22 | return True |
| 23 | except Exception as e: |
| 24 | print("Invalid s3 key.") |
| 25 | return False |
| 26 | |
| 27 | |
| 28 | def dos2unix(directory): |
Tested by
no test coverage detected