Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • 3
    while using client should we check HTTPStatusCode in response resp["ResponseMetadata"].get("HTTPStatusCode") != 200? I mean does the api always throw exception if status code is not 200? Commented Nov 18, 2018 at 4:31
  • 2
    @himanshu219 Good question.There's no clear guidance on this and a search for HTTPStatusCode in the boto3 docs yields no results. In my experience, however, you can rely on an exception being thrown. Commented Nov 18, 2018 at 16:17
  • 1
    In any event, you should not use only 200 in your check, as the return code could be a different 2xx HTTP status code (e.g., 204 when deleting a vault or archive, 201 when creating, etc.). At best, one should check for a non-4xx code (e.g., statusCode < 400) but that's really brittle and I would not recommend it anyway: best to rely on boto throwing exceptions at your code. Commented Jan 16, 2019 at 3:29
  • 3
    Yes, the api always throws exceptions. See botocore.amazonaws.com/v1/documentation/api/latest/… Commented Sep 1, 2020 at 16:18
  • 1
    I really miss checked exceptions. Commented Feb 24, 2021 at 1:04