Skip to content

Instantly share code, notes, and snippets.

@PetrGlad
Created February 20, 2018 15:43
Show Gist options
  • Save PetrGlad/d257ac451f0633c4a70fb2a004acc99a to your computer and use it in GitHub Desktop.
Save PetrGlad/d257ac451f0633c4a70fb2a004acc99a to your computer and use it in GitHub Desktop.
aws-examples
import boto3
import gzip
s3 = boto3.client('s3')
# get gz file content
content = gzip.decompress(
s3.get_object(Bucket='a-bucket-id',
Key='a-key')['Body'].read())
# list files/objects
all_files = [x['Key'] for x in s3.list_objects_v2(Bucket='a-bucket-id', Prefix='a-key')['Contents']]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment