python boto3

Solutions on MaxInterview for python boto3 by the best coders in the world

showing results for - "python boto3"
Tommaso
23 Oct 2017
1#to install
2pip install boto3
3# example codes
4
5import boto3
6
7# Let's use Amazon S3
8s3 = boto3.resource('s3')
9
10# Print out bucket names
11for bucket in s3.buckets.all():
12    print(bucket.name)
13    
14# Upload a new file
15data = open('test.jpg', 'rb')
16s3.Bucket('my-bucket').put_object(Key='test.jpg', Body=data)