Last active
June 28, 2022 00:28
-
-
Save BarakStout/de8040a54cccda78a8e85ce2444cd5d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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