I can upload or someone uploaded a csv file into my spaces using boto3.
import boto3
session = boto3.session.Session()
client = session.client('s3',
endpoint_url=ENDPOINT_URL,
aws_access_key_id=ACCESS_KEY,
aws_secret_access_key=SECRET_KEY)
file_to_copy = 'myfile.csv'
dest_file = 'myfile.csv'
client.upload_file(file_to_copy, SPACE_NAME, dest_file)
The permission is set to private.
Now I want to read that file using pandas dataframe without setting the file to public and without the quick share feature though. Is that even possible using boto3? Or perhaps not boto3 as long as it uses python.
Note:
Thanks a lot.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
All right I found it.
Download private file from DO space.
I got some ideas from this github repo https://github.com/ChariotDev/digital-ocean-spaces
Heya,
Another tool you can use is
s3cmd
to handle the operations for you! You can check this question here:https://www.digitalocean.com/community/questions/how-to-manage-digitalocean-spaces-using-s3cmd
Regards
Heya,
You should be able to achieve this by directly downloading the file into memory and then reading it then. Instead of downloading the file to the filesystem, you can download it into a buffer in memory using
io.BytesIO
.Here’s how I think you can do it:
Hope it helps