Spaces:
Runtime error
Runtime error
import boto3 | |
import os | |
# Make aws_access_key_id and aws_secret_access_key as environment variables | |
aws_access_key_id_env = os.environ['AWS_ACCESS_KEY_ID'] | |
aws_secret_access_key_env = os.environ['AWS_SECRET_ACCESS_KEY'] | |
# Let's use S3 | |
s3 = boto3.resource( | |
service_name='s3', | |
aws_access_key_id=aws_access_key_id_env, | |
aws_secret_access_key=aws_secret_access_key_env, | |
endpoint_url='https://s3.tebi.io' | |
) | |
# Print out bucket names | |
for bucket in s3.buckets.all(): | |
print(bucket.name) | |
# Upload a new file | |
data = open('stock_price_distribution.png', 'rb') | |
s3.Bucket('montecarlo-automated-images').put_object(Key='stock_price_distribution.png', Body=data) |