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 :: how to bold in colorama 
Python :: python check if string contains 
Python :: how to install python pyautogui 
Python :: python if 
Python :: remove specific character from object in pandas column using iloc 
Python :: python script in excel 
Python :: compose functions python 
Python :: python documentation 
Python :: remove special characters from string in python 
Python :: simple jwt 
Python :: pandas add value to excel column and save 
Python :: deleting in a text file in python 
Python :: check if something is nan python 
Python :: csr_matric scipy lib 
Python :: render django template 
Python :: how to install docx in python 
Python :: superscript python 
Python :: numpy mean 
Python :: how to convert csv to excel in python 
Python :: how to check a string is palindrome or not in python 
Python :: python split string after substring 
Python :: access env variable in flask 
Python :: pyqt remove widget 
Python :: install python3 in ubuntu 
Python :: update nested dictionary python 
Python :: transpose list 
Python :: media pipe install ERROR: Could not find a version that satisfies the requirement mediapipe (from versions: none) 
Python :: python discord 
Python :: import stock data from yahoo finance 
Python :: django message 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =