Skip to content

Instantly share code, notes, and snippets.

@koolhead17
Created October 27, 2016 19:33
Show Gist options
  • Save koolhead17/20404d171b6f08af6869a82ba846d928 to your computer and use it in GitHub Desktop.
Save koolhead17/20404d171b6f08af6869a82ba846d928 to your computer and use it in GitHub Desktop.
import boto3
from botocore.client import Config
import requests
# Get the service client.
s3 = boto3.resource('s3',
endpoint_url='http://localhost:9000',
aws_access_key_id='BKIKJAA5BMMU2RHO6IBB ',
aws_secret_access_key='V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12',
config=Config(signature_version='s3v4'),
region_name='us-east-1')
# Generate the URL to get 'key-name' from 'bucket-name'
url = s3.generate_presigned_url(
ClientMethod='get_object',
Params={
'Bucket': 'atul',
'Key': 'eReceipt.pdf'
}
)
# Use the URL to perform the GET operation. You can use any method you like
# to send the GET, but we will use requests here to keep things simple.
response = requests.get(url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment