From 6eb27a2b7b1afa8b754d44826bf1def2324a86c5 Mon Sep 17 00:00:00 2001 From: Jakob Keller <57402305+jakob-keller@users.noreply.github.com> Date: Sun, 27 Oct 2024 14:40:38 +0100 Subject: [PATCH] bump `botocore` dependency specification --- CHANGES.rst | 4 ++-- aiobotocore/__init__.py | 2 +- aiobotocore/handlers.py | 25 +++++-------------------- aiobotocore/hooks.py | 3 --- pyproject.toml | 6 +++--- tests/test_patches.py | 6 ++---- 6 files changed, 13 insertions(+), 33 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 142a4bd9..724ee5b5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,9 +1,9 @@ Changes ------- -2.15.3 (2024-10-27) +2.16.0 (2024-10-27) ^^^^^^^^^^^^^^^^^^^ -* relax botocore dependency specification +* bump botocore dependency specification 2.15.2 (2024-10-09) ^^^^^^^^^^^^^^^^^^^ diff --git a/aiobotocore/__init__.py b/aiobotocore/__init__.py index 4895c882..48aa744f 100644 --- a/aiobotocore/__init__.py +++ b/aiobotocore/__init__.py @@ -1 +1 @@ -__version__ = '2.15.3' +__version__ = '2.16.0' diff --git a/aiobotocore/handlers.py b/aiobotocore/handlers.py index c060ab94..1c0b0df6 100644 --- a/aiobotocore/handlers.py +++ b/aiobotocore/handlers.py @@ -1,13 +1,14 @@ from botocore.handlers import ( ETree, - XMLParseError, _get_cross_region_presigned_url, _get_presigned_url_source_and_destination_regions, + _looks_like_special_case_error, logger, ) async def check_for_200_error(response, **kwargs): + """This function has been deprecated, but is kept for backwards compatibility.""" # From: http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectCOPY.html # There are two opportunities for a copy request to return an error. One # can occur when Amazon S3 receives the copy request and the other can @@ -28,7 +29,9 @@ async def check_for_200_error(response, **kwargs): # trying to retrieve the response. See Endpoint._get_response(). return http_response, parsed = response - if await _looks_like_special_case_error(http_response): + if _looks_like_special_case_error( + http_response.status_code, await http_response.content + ): logger.debug( "Error found for response with 200 status code, " "errors: %s, changing status code to " @@ -38,24 +41,6 @@ async def check_for_200_error(response, **kwargs): http_response.status_code = 500 -async def _looks_like_special_case_error(http_response): - if http_response.status_code == 200: - try: - parser = ETree.XMLParser( - target=ETree.TreeBuilder(), encoding='utf-8' - ) - parser.feed(await http_response.content) - root = parser.close() - except XMLParseError: - # In cases of network disruptions, we may end up with a partial - # streamed response from S3. We need to treat these cases as - # 500 Service Errors and try again. - return True - if root.tag == 'Error': - return True - return False - - async def inject_presigned_url_ec2(params, request_signer, model, **kwargs): # The customer can still provide this, so we should pass if they do. if 'PresignedUrl' in params['body']: diff --git a/aiobotocore/hooks.py b/aiobotocore/hooks.py index eaae300e..62fea11a 100644 --- a/aiobotocore/hooks.py +++ b/aiobotocore/hooks.py @@ -1,4 +1,3 @@ -from botocore.handlers import check_for_200_error as boto_check_for_200_error from botocore.handlers import ( inject_presigned_url_ec2 as boto_inject_presigned_url_ec2, ) @@ -21,7 +20,6 @@ from ._helpers import resolve_awaitable from .handlers import ( - check_for_200_error, inject_presigned_url_ec2, inject_presigned_url_rds, parse_get_bucket_location, @@ -39,7 +37,6 @@ boto_add_generate_presigned_post: add_generate_presigned_post, boto_add_generate_db_auth_token: add_generate_db_auth_token, boto_parse_get_bucket_location: parse_get_bucket_location, - boto_check_for_200_error: check_for_200_error, } diff --git a/pyproject.toml b/pyproject.toml index 3b221929..17ccd147 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ classifiers = [ dynamic = ["version", "readme"] dependencies = [ - "botocore >=1.35.16, <1.35.45", # NOTE: When updating, always keep `project.optional-dependencies` aligned + "botocore >=1.35.45, <1.35.46", # NOTE: When updating, always keep `project.optional-dependencies` aligned "aiohttp >=3.9.2, <4.0.0", "wrapt >=1.10.10, <2.0.0", "aioitertools >=0.5.1, <1.0.0", @@ -38,10 +38,10 @@ dependencies = [ [project.optional-dependencies] awscli = [ - "awscli >=1.34.16, <1.35.11", + "awscli >=1.35.11, <1.35.12", ] boto3 = [ - "boto3 >=1.35.16, <1.35.45", + "boto3 >=1.35.45, <1.35.46", ] [project.urls] diff --git a/tests/test_patches.py b/tests/test_patches.py index 1652be73..1fc1c40e 100644 --- a/tests/test_patches.py +++ b/tests/test_patches.py @@ -43,7 +43,6 @@ ) from botocore.eventstream import EventStream from botocore.handlers import ( - _looks_like_special_case_error, check_for_200_error, inject_presigned_url_ec2, inject_presigned_url_rds, @@ -624,9 +623,8 @@ inject_presigned_url_rds: {'b5d45b339686346e81b255d4e8c36e76d3fe6a78'}, inject_presigned_url_ec2: {'48e09a5e4e95577e716be30f2d2706949261a07f'}, parse_get_bucket_location: {'64ffbf5c6aa6ebd083f49371000fa046d0de1fc6'}, - check_for_200_error: {'ded7f3aaef7b1a5d047c4dac86692ab55cbd7a13'}, - _looks_like_special_case_error: { - '86946722d10a72b593483fca0abf30100c609178' + check_for_200_error: { + '3a00f0bea409528f8457d6569aecf05998094386', }, # httpsession.py URLLib3Session: {