Skip to content

Commit

Permalink
Fix compatibility with botocore 1.33.2 (#1206)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikonst authored Nov 29, 2023
1 parent b25a88e commit 7b60000
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 7 deletions.
19 changes: 19 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt
4 changes: 4 additions & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release Notes
=============

v5.5.1
----------
* Fix compatibility with botocore 1.33.2 (#1205)

v5.5.0
----------
* :meth:`~pynamodb.models.Model.save`, :meth:`~pynamodb.models.Model.update`, :meth:`~pynamodb.models.Model.delete_item`,
Expand Down
5 changes: 4 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
sphinx-rtd-theme==0.4.3
.[signals]
sphinx>=5
sphinx-rtd-theme==1.1.1
sphinx-issues
2 changes: 1 addition & 1 deletion pynamodb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"""
__author__ = 'Jharrod LaFon'
__license__ = 'MIT'
__version__ = '5.5.0'
__version__ = '5.5.1'
9 changes: 4 additions & 5 deletions pynamodb/connection/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import botocore.client
import botocore.exceptions
from botocore.awsrequest import AWSPreparedRequest, create_request_object
from botocore.awsrequest import AWSPreparedRequest, create_request_object, AWSResponse
from botocore.client import ClientError
from botocore.hooks import first_non_none_response
from botocore.exceptions import BotoCoreError
Expand Down Expand Up @@ -380,9 +380,11 @@ def _make_api_call(self, operation_name: str, operation_kwargs: Dict, settings:
'has_streaming_input': operation_model.has_streaming_input,
'auth_type': operation_model.auth_type,
}
endpoint_url, additional_headers = self.client._resolve_endpoint_ruleset(
endpoint_url, additional_headers, *rest = self.client._resolve_endpoint_ruleset(
operation_model, operation_kwargs, request_context
)
if rest and rest[0]:
request_context['endpoint_properties'] = rest[0]
request_dict = self.client._convert_to_request_dict(
api_params=operation_kwargs,
operation_model=operation_model,
Expand All @@ -400,7 +402,6 @@ def _make_api_call(self, operation_name: str, operation_kwargs: Dict, settings:
attempt_number = i + 1
is_last_attempt_for_exceptions = i == self._max_retry_attempts_exception

http_response = None
prepared_request = None
try:
if prepared_request is not None:
Expand Down Expand Up @@ -432,8 +433,6 @@ def _make_api_call(self, operation_name: str, operation_kwargs: Dict, settings:
except (ValueError, botocore.exceptions.HTTPClientError, botocore.exceptions.ConnectionError) as e:
if is_last_attempt_for_exceptions:
log.debug('Reached the maximum number of retry attempts: %s', attempt_number)
if http_response:
e.args += (http_response.text,)
raise
else:
# No backoff for fast-fail exceptions that likely failed at the frontend
Expand Down

0 comments on commit 7b60000

Please sign in to comment.