Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

read file from s3 python

boto3 offers a resource model that makes tasks like iterating through objects easier. Unfortunately, StreamingBody doesn't provide readline or readlines.

s3 = boto3.resource('s3')
bucket = s3.Bucket('test-bucket')
# Iterates through all the objects, doing the pagination for you. Each obj
# is an ObjectSummary, so it doesn't contain the body. You'll need to call
# get to get the whole body.
for obj in bucket.objects.all():
    key = obj.key
    body = obj.get()['Body'].read()
Comment

PREVIOUS NEXT
Code Example
Python :: ParserError: Error tokenizing data. C error: Expected 1 fields in line 6, saw 3 
Python :: what is python used for 
Python :: python while not 
Python :: python rgb colors 
Python :: how to draw a rectangle in pygame 
Python :: python execute shell command and get output 
Python :: python take the month of date in new column 
Python :: calcutalte average python 
Python :: check strings last letter python 
Python :: get user ip address django 
Python :: python get volume free space 
Python :: how to change a header in pandas 
Python :: pre commit python 
Python :: pandas difference between dates 
Python :: concatenate dataframes 
Python :: python break long string multiple lines 
Python :: python change terminal name 
Python :: is power of python recursion 
Python :: how to print time python 
Python :: python continue 
Python :: if object has property python 
Python :: python random hash 
Python :: The specified file cannot be played on the specified MCI device. The file may be corrupt, not in the correct format, or no file handler available for this format. python 
Python :: stack data horizontally pandas 
Python :: python count number of unique elements in a list 
Python :: how to get the type of a variable in python 
Python :: python print boolean 
Python :: find the factorial of a given integer in python 
Python :: how to install whl file in python 
Python :: how to use a string variable as a variable name in python 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =