Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get files from s3 bucket python

import boto3
import botocore

BUCKET_NAME = 'my-bucket' # replace with your bucket name
KEY = 'my_image_in_s3.jpg' # replace with your object key

s3 = boto3.resource('s3')

try:
    s3.Bucket(BUCKET_NAME).download_file(KEY, 'my_local_image.jpg')
except botocore.exceptions.ClientError as e:
    if e.response['Error']['Code'] == "404":
        print("The object does not exist.")
    else:
        raise
Comment

read data from s3 bucket python

# read data from s3 bucket python
s3 = boto3.resource('s3')
bucket = s3.Bucket('test-bucket')
for object in bucket.objects.all():
    key = object.key
    body = object.get()['Body'].read()
Comment

PREVIOUS NEXT
Code Example
Python :: path to create a text file in python 
Python :: How to split a text column into two separate columns? 
Python :: python timestamp to yyyy-mm-dd 
Python :: isntall packages to databricks 
Python :: pandas nan to none 
Python :: reportlab python draw line 
Python :: how to sort list of dictionaries in python 
Python :: copy website python 
Python :: check all values in dictionary python 
Python :: how to make a list using lambda function in python 
Python :: move column in pandas 
Python :: create a blank image numpy 
Python :: pandas add quantile columns 
Python :: count list python 
Python :: pyqt5 keypressevent 
Python :: reverse range in python 
Python :: tuple length in python 
Python :: get number of zero is a row pandas 
Python :: python read file from same directory 
Python :: show columns pandas 
Python :: python asctime 
Python :: split word python 
Python :: sys.path.append python 
Python :: discord py import commands 
Python :: how to define the name of your tkinter window 
Python :: streamlit button 
Python :: python get attributes of object 
Python :: how to import your own function python 
Python :: Display max number of columns pandas 
Python :: How to loop over grouped Pandas dataframe? 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =