Skip to content

Instantly share code, notes, and snippets.

@tati
Last active February 25, 2018 03:10
Show Gist options
  • Save tati/73104791bafb58befa092867b6d579e5 to your computer and use it in GitHub Desktop.
Save tati/73104791bafb58befa092867b6d579e5 to your computer and use it in GitHub Desktop.
from boto3 import session
from botocore.client import Config
ACCESS_ID = 'XXXXXXX'
SECRET_KEY = 'XXXXXXX'
# Initiate session
session = session.Session()
client = session.client('s3',
region_name='nyc3',
endpoint_url='https://nyc3.digitaloceanspaces.com',
aws_access_key_id=ACCESS_ID,
aws_secret_access_key=SECRET_KEY)
# Upload a file to your Space
client.upload_file('test.html', 'hello-spaces', 'new-folder/new_file_name.html')
@k1ltr0
Copy link

k1ltr0 commented Feb 25, 2018

I think last line of the example is incorrect, from docs, this should be:

client.upload_file('new-folder/new_file_name.html', 'hello-spaces', 'test.html')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment