Skip to content

Commit 56beacc

Browse files
authored
Bump botocore dependency specification (#1391)
1 parent d5ff89f commit 56beacc

File tree

15 files changed

+135
-64
lines changed

15 files changed

+135
-64
lines changed

CHANGES.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Changes
22
-------
3+
4+
2.24.2 (2025-08-26)
5+
^^^^^^^^^^^^^^^^^^^
6+
* bump botocore dependency specification
7+
38
2.24.1 (2025-08-15)
49
^^^^^^^^^^^^^^^^^^^
510
* fix endpoint circular import error

aiobotocore/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.24.1'
1+
__version__ = '2.24.2'

aiobotocore/credentials.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
from copy import deepcopy
66

77
import botocore.compat
8+
import dateutil.parser
89
from botocore import UNSIGNED
9-
from botocore.compat import compat_shell_split
10+
from botocore.compat import compat_shell_split, total_seconds
1011
from botocore.config import Config
1112
from botocore.credentials import (
1213
_DEFAULT_ADVISORY_REFRESH_TIMEOUT,
@@ -1048,7 +1049,16 @@ async def _get_credentials(self):
10481049
initial_token_data = self._token_provider.load_token()
10491050
token = (await initial_token_data.get_frozen_token()).token
10501051
else:
1051-
token = self._token_loader(self._start_url)['accessToken']
1052+
token_dict = self._token_loader(self._start_url)
1053+
token = token_dict['accessToken']
1054+
1055+
# raise an UnauthorizedSSOTokenError if the loaded legacy token
1056+
# is expired to save a call to GetRoleCredentials with an
1057+
# expired token.
1058+
expiration = dateutil.parser.parse(token_dict['expiresAt'])
1059+
remaining = total_seconds(expiration - self._time_fetcher())
1060+
if remaining <= 0:
1061+
raise UnauthorizedSSOTokenError()
10521062

10531063
kwargs = {
10541064
'roleName': self._role_name,

aiobotocore/discovery.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ async def describe_endpoint(self, **kwargs):
3333
if not self._always_discover and not discovery_required:
3434
# Discovery set to only run on required operations
3535
logger.debug(
36-
f'Optional discovery disabled. Skipping discovery for Operation: {operation}'
36+
'Optional discovery disabled. Skipping discovery for Operation: %s',
37+
operation,
3738
)
3839
return None
3940

aiobotocore/httpchecksum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ async def handle_checksum_body(
196196
return
197197

198198
logger.debug(
199-
f'Skipping checksum validation. Response did not contain one of the '
200-
f'following algorithms: {algorithms}.'
199+
'Skipping checksum validation. Response did not contain one of the following algorithms: %s.',
200+
algorithms,
201201
)
202202

203203

aiobotocore/regions.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async def construct_endpoint(
2727
operation_model, call_args, request_context
2828
)
2929
LOG.debug(
30-
f'Calling endpoint provider with parameters: {provider_params}'
30+
'Calling endpoint provider with parameters: %s', provider_params
3131
)
3232
try:
3333
provider_result = self._provider.resolve_endpoint(
@@ -41,10 +41,14 @@ async def construct_endpoint(
4141
raise
4242
else:
4343
raise botocore_exception from ex
44-
LOG.debug(f'Endpoint provider result: {provider_result.url}')
44+
LOG.debug('Endpoint provider result: %s', provider_result.url)
4545

4646
# The endpoint provider does not support non-secure transport.
47-
if not self._use_ssl and provider_result.url.startswith('https://'):
47+
if (
48+
not self._use_ssl
49+
and provider_result.url.startswith('https://')
50+
and 'Endpoint' not in provider_params
51+
):
4852
provider_result = provider_result._replace(
4953
url=f'http://{provider_result.url[8:]}'
5054
)

aiobotocore/session.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,9 @@ async def _create_client(
191191
aws_session_token, aws_account_id
192192
):
193193
logger.debug(
194-
f"Ignoring the following credential-related values which were set without "
195-
f"an access key id and secret key on the session or client: {ignored_credentials}"
194+
"Ignoring the following credential-related values which were set without "
195+
"an access key id and secret key on the session or client: %s",
196+
ignored_credentials,
196197
)
197198
credentials = await self.get_credentials()
198199
auth_token = self.get_auth_token()

aiobotocore/signers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import botocore
44
import botocore.auth
5+
from botocore.compat import get_current_datetime
56
from botocore.exceptions import ParamValidationError, UnknownClientMethodError
67
from botocore.signers import (
78
RequestSigner,
@@ -157,6 +158,10 @@ async def get_auth_instance(
157158
return auth
158159

159160
credentials = request_credentials or self._credentials
161+
if credentials and (
162+
cred_method := getattr(credentials, 'method', None)
163+
):
164+
self.check_and_register_feature_id(cred_method)
160165
if getattr(cls, "REQUIRES_IDENTITY_CACHE", None) is True:
161166
cache = kwargs["identity_cache"]
162167
key = kwargs["cache_key"]
@@ -368,7 +373,7 @@ async def generate_presigned_post(
368373
policy = {}
369374

370375
# Create an expiration date for the policy
371-
datetime_now = datetime.datetime.utcnow()
376+
datetime_now = get_current_datetime()
372377
expire_date = datetime_now + datetime.timedelta(seconds=expires_in)
373378
policy['expiration'] = expire_date.strftime(botocore.auth.ISO8601)
374379

aiobotocore/tokens.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ async def _refresh_access_token(self, token):
125125

126126
expiry = dateutil.parser.parse(token["registrationExpiresAt"])
127127
if total_seconds(expiry - self._now()) <= 0:
128-
logger.info(f"SSO token registration expired at {expiry}")
128+
logger.info("SSO token registration expired at %s", expiry)
129129
return None
130130

131131
try:
@@ -137,10 +137,10 @@ async def _refresh_access_token(self, token):
137137
async def _refresher(self):
138138
start_url = self._sso_config["sso_start_url"]
139139
session_name = self._sso_config["session_name"]
140-
logger.info(f"Loading cached SSO token for {session_name}")
140+
logger.info("Loading cached SSO token for %s", session_name)
141141
token_dict = self._token_loader(start_url, session_name=session_name)
142142
expiration = dateutil.parser.parse(token_dict["expiresAt"])
143-
logger.debug(f"Cached SSO token expires at {expiration}")
143+
logger.debug("Cached SSO token expires at %s", expiration)
144144

145145
remaining = total_seconds(expiration - self._now())
146146
if remaining < self._REFRESH_WINDOW:

aiobotocore/utils.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -486,16 +486,21 @@ async def redirect_from_error(
486486

487487
if new_region is None:
488488
logger.debug(
489-
f"S3 client configured for region {client_region} but the "
490-
f"bucket {bucket} is not in that region and the proper region "
491-
"could not be automatically determined."
489+
"S3 client configured for region %s but the "
490+
"bucket %s is not in that region and the proper region "
491+
"could not be automatically determined.",
492+
client_region,
493+
bucket,
492494
)
493495
return
494496

495497
logger.debug(
496-
f"S3 client configured for region {client_region} but the bucket {bucket} "
497-
f"is in region {new_region}; Please configure the proper region to "
498-
f"avoid multiple unnecessary redirects and signing attempts."
498+
"S3 client configured for region %s but the bucket %s "
499+
"is in region %s; Please configure the proper region to "
500+
"avoid multiple unnecessary redirects and signing attempts.",
501+
client_region,
502+
bucket,
503+
new_region,
499504
)
500505
# Adding the new region to _cache will make construct_endpoint() to
501506
# use the new region as value for the AWS::Region builtin parameter.
@@ -622,16 +627,21 @@ async def redirect_from_error(
622627

623628
if new_region is None:
624629
logger.debug(
625-
f"S3 client configured for region {client_region} but the bucket {bucket} is not "
630+
"S3 client configured for region %s but the bucket %s is not "
626631
"in that region and the proper region could not be "
627-
"automatically determined."
632+
"automatically determined.",
633+
client_region,
634+
bucket,
628635
)
629636
return
630637

631638
logger.debug(
632-
f"S3 client configured for region {client_region} but the bucket {bucket} is in region"
633-
f" {new_region}; Please configure the proper region to avoid multiple "
634-
"unnecessary redirects and signing attempts."
639+
"S3 client configured for region %s but the bucket %s is in region"
640+
" %s; Please configure the proper region to avoid multiple "
641+
"unnecessary redirects and signing attempts.",
642+
client_region,
643+
bucket,
644+
new_region,
635645
)
636646
endpoint = self._endpoint_resolver.resolve('s3', new_region)
637647
endpoint = endpoint['endpoint_url']

0 commit comments

Comments
 (0)