Skip to content

Commit 7b60000

Browse files
authored
Fix compatibility with botocore 1.33.2 (#1206)
1 parent b25a88e commit 7b60000

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

.readthedocs.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
version: 2
6+
7+
build:
8+
os: ubuntu-22.04
9+
tools:
10+
python: "3.11"
11+
12+
# Build documentation in the docs/ directory with Sphinx
13+
sphinx:
14+
configuration: docs/conf.py
15+
16+
# Optionally declare the Python requirements required to build your docs
17+
python:
18+
install:
19+
- requirements: docs/requirements.txt

docs/release_notes.rst

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
Release Notes
44
=============
55

6+
v5.5.1
7+
----------
8+
* Fix compatibility with botocore 1.33.2 (#1205)
9+
610
v5.5.0
711
----------
812
* :meth:`~pynamodb.models.Model.save`, :meth:`~pynamodb.models.Model.update`, :meth:`~pynamodb.models.Model.delete_item`,

docs/requirements.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
sphinx-rtd-theme==0.4.3
1+
.[signals]
2+
sphinx>=5
3+
sphinx-rtd-theme==1.1.1
4+
sphinx-issues

pynamodb/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
"""
88
__author__ = 'Jharrod LaFon'
99
__license__ = 'MIT'
10-
__version__ = '5.5.0'
10+
__version__ = '5.5.1'

pynamodb/connection/base.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import botocore.client
1616
import botocore.exceptions
17-
from botocore.awsrequest import AWSPreparedRequest, create_request_object
17+
from botocore.awsrequest import AWSPreparedRequest, create_request_object, AWSResponse
1818
from botocore.client import ClientError
1919
from botocore.hooks import first_non_none_response
2020
from botocore.exceptions import BotoCoreError
@@ -380,9 +380,11 @@ def _make_api_call(self, operation_name: str, operation_kwargs: Dict, settings:
380380
'has_streaming_input': operation_model.has_streaming_input,
381381
'auth_type': operation_model.auth_type,
382382
}
383-
endpoint_url, additional_headers = self.client._resolve_endpoint_ruleset(
383+
endpoint_url, additional_headers, *rest = self.client._resolve_endpoint_ruleset(
384384
operation_model, operation_kwargs, request_context
385385
)
386+
if rest and rest[0]:
387+
request_context['endpoint_properties'] = rest[0]
386388
request_dict = self.client._convert_to_request_dict(
387389
api_params=operation_kwargs,
388390
operation_model=operation_model,
@@ -400,7 +402,6 @@ def _make_api_call(self, operation_name: str, operation_kwargs: Dict, settings:
400402
attempt_number = i + 1
401403
is_last_attempt_for_exceptions = i == self._max_retry_attempts_exception
402404

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

0 commit comments

Comments
 (0)