Skip to content

Commit

Permalink
bump botocore dependency specification
Browse files Browse the repository at this point in the history
  • Loading branch information
jakob-keller committed Oct 28, 2024
1 parent efbdd66 commit de1faf9
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 33 deletions.
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Changes
-------

2.15.3 (2024-10-27)
2.16.0 (2024-10-28)
^^^^^^^^^^^^^^^^^^^
* relax botocore dependency specification
* bump botocore dependency specification

2.15.2 (2024-10-09)
^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion aiobotocore/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.15.3'
__version__ = '2.16.0'
25 changes: 5 additions & 20 deletions aiobotocore/handlers.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 "
Expand All @@ -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']:
Expand Down
3 changes: 0 additions & 3 deletions aiobotocore/hooks.py
Original file line number Diff line number Diff line change
@@ -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,
)
Expand All @@ -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,
Expand All @@ -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,
}


Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ classifiers = [
dynamic = ["version", "readme"]

dependencies = [
"botocore >=1.35.16, <1.35.45", # NOTE: When updating, always keep `project.optional-dependencies` aligned
"botocore >=1.35.47, <1.35.51", # 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",
]

[project.optional-dependencies]
awscli = [
"awscli >=1.34.16, <1.35.11",
"awscli >=1.35.13, <1.35.17",
]
boto3 = [
"boto3 >=1.35.16, <1.35.45",
"boto3 >=1.35.47, <1.35.51",
]

[project.urls]
Expand Down
6 changes: 2 additions & 4 deletions tests/test_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit de1faf9

Please sign in to comment.