2 réponses
- Le plus récent
- Le plus de votes
- La plupart des commentaires
1
The S3 API guide provides all possible error responses thrown by the S3 service. Additionally, the Python package aws-error-utils can streamline some of the error handling in boto3.
répondu il y a 2 ans
1
You could try to catch ClientError and then parse the error response, for example,
import boto3, botocore.exceptions
s3 = boto3.client('s3')
try:
s3.get_object(Bucket='some-bucket', Key='some key')
except botocore.exceptions.ClientError as error:
if error.response['Error']['Code'] == 'NoSuchKey':
print('No such object')
else: # Unknown exception
print(error.response)
répondu il y a 2 ans
Oh. Would that ClientError under botocore.exceptions catch a EndpointConnectionError? This job runs for a day or two so it takes a while to reproduce.
@jschwar313 You can generate a list of the statically defined botocore exceptions using the following code (taken from boto3 docs
import botocore.exceptions for key, value in sorted(botocore.exceptions.__dict__.items()): if isinstance(value, type): print(key)
Contenus pertinents
- demandé il y a 7 mois
- demandé il y a un an
- demandé il y a un an
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 3 ans
- AWS OFFICIELA mis à jour il y a 2 ans
Thanks. I'll try and reproduce the problem with that aws_error_utils package being used. I'll see if that helps. Thanks.