简体   繁体   中英

Download images saved on Amazon S3

I need to download images that are uploaded by https://webapp.spypoint.com . These images are saved in Amazon S3. The url for this image is something like this as: https://s3.amazonaws.com/spypoint/1111/2222/3333/img.jpg

I have id and password to log in https://webapp.spypoint.com . My goal is to download images from Amazon S3 directly using boto3.

I researched about it and all information was about downloading images from Amazon S3 bucket owned by myself. For my case, the Amazon S3 storage/bucket is owned by https://webapp.spypoint.com .

If it's a public bucket, then this will work:

from PIL import Image
from io import BytesIO
import requests

url = "https://s3.amazonaws.com/spypoint/1111/2222/3333/img.jpg"
Image.open(BytesIO(requests.get(url).content))

But you cannot 'explore' the bucket this way, eg getting a listing, etc. You need to go through the S3 API for that, eg using boto3 , as you say. And it sounds like it's not a public bucket.

If it's their bucket, then to get to it via the S3 API (eg with boto3 ), they will have to allow you to access it. Or maybe they have their own API?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM