Skip to content

Instantly share code, notes, and snippets.

@hngkr
Created July 12, 2019 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hngkr/82005efed362bb57cee9211afaee32e6 to your computer and use it in GitHub Desktop.
Save hngkr/82005efed362bb57cee9211afaee32e6 to your computer and use it in GitHub Desktop.
NamedTemporaryFile example
import boto3
import tempfile
s3_bucket = "..."
s3_path = "..."
s3 = boto3.resource('s3', region_name='eu-west-1')
with tempfile.NamedTemporaryFile() as downloaded_file:
s3.Object(s3_bucket, s3_path).download_file(downloaded_file.name)
# continue processing downloaded_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment