Data Images Download from Python code

Hi,

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:
try:
os_rr = ‘aws s3 cp ‘+url_i+’ /media/ --no-sign-request’
subprocess.call(os_rr, shell=True)
print(str(kkk),urls)
kkk = kkk + 1
except:
print('erro: ',url_i)
erro_list.append(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