Data Images Download from Python code


We have some difficulties to download images from aws S3 from Python.

We got this error => ClientError: An error occurred (InvalidAccessKeyId) when calling the ListObjects operation: The AWS Access Key Id you provided does not exist in our records.

We succeed to download images from command line (aws s3 cp s3://drivendata-competition-visiomel-public-us/images/1u4lhlqb.tif ./ --no-sign-request) but not from python

Is there some configuration to put somewhere else to get images from Python. Can you help us ?

Thank you.

IAvengers TEAM.

import os

import subprocess

urls = [‘s3://drivendata-competition-visiomel-public-as/images/4xqs6vif.tif’, ‘s3://drivendata-competition-visiomel-public-as/images/4xejray1.tif’]

erro_list =
kkk = 1
for url_i in urls:
os_rr = ‘aws s3 cp ‘+url_i+’ /media/ --no-sign-request’, shell=True)
kkk = kkk + 1
print('erro: ',url_i)

This is my script at the time of the download, a simple reference, I hope it can help you

Hi Biototem,

Thank you for your reply. We finally succeed to get images from Python using “no_sign_request” parameter => S3Path(image_s3_path,
client=S3Client(local_cache_dir=‘/tmp/images’, no_sign_request=True)).fspath