Spaces:
Runtime error
Runtime error
File size: 669 Bytes
b8429e3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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) |