Reputation: 37
I've been working on a service where I must grab a csv file from an S3 bucket, then send it all using python. I've tried various different methods such as MIMEapplication, however all have encountered problems : (
I think the biggest issue is that most examples define a path to a local directory, opposed to accessing the file through s3, so any help would be appreciated !!!
Upvotes: 0
Views: 863
Reputation: 269826
You would first need to download the file from the Amazon S3 bucket to the local disk.
For example:
import boto3
s3 = boto3.client('s3')
s3.download_file('my-bucket', 'object-name', '/tmp/filename')
Alternatively, you might be able to use smart-open · PyPI, which gives the ability to open()
a file in Amazon S3 as if it were on a local disk.
Upvotes: 2