Skip to content

Instantly share code, notes, and snippets.

@sengstacken
Created March 17, 2020 18:55
Show Gist options
  • Save sengstacken/4674a12894e433a99d6df246e7e657be to your computer and use it in GitHub Desktop.
Save sengstacken/4674a12894e433a99d6df246e7e657be to your computer and use it in GitHub Desktop.
Read S3 File Into Python
import boto3
import json
bucket = 'blah'
f = 'fileblah'
# get file from s3, read it, convert to json
s3 = boto3.resource('s3')
content_object = s3.Object(bucket, f)
file_content = content_object.get()['Body'].read().decode('utf-8')
json_content = json.loads(file_content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment