Skip to content

Instantly share code, notes, and snippets.

@BarakStout
Last active June 28, 2022 00:28
Show Gist options
  • Save BarakStout/de8040a54cccda78a8e85ce2444cd5d5 to your computer and use it in GitHub Desktop.
Save BarakStout/de8040a54cccda78a8e85ce2444cd5d5 to your computer and use it in GitHub Desktop.
# Install >> https://www.linode.com/docs/products/storage/object-storage/guides/aws-sdk-for-python/
# [optional] s3cmd util https://www.linode.com/docs/products/storage/object-storage/guides/s3cmd/
import boto3
# Connect
linode_obj_config = {
"aws_access_key_id": "",
"aws_secret_access_key": "",
"endpoint_url": "https://us-east-1.linodeobjects.com",
}
client = boto3.client("s3", **linode_obj_config)
# List buckets
response = client.list_buckets()
print(response)
for bucket in response['Buckets']:
print(bucket['Name'])
# List objects
response = client.list_objects(Bucket='raftlabs-hil')
for object in response['Contents']:
print(object['Key'])
# Download
client.download_file(
Bucket='raftlabs-hil',
Key='data-fabric-demo-jun-22.gif',
Filename='[COPY]data-fabric-demo-jun-22.gif')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment