Skip to content

Commit

Permalink
Merge pull request #1270 from jakob-keller/allow_ttl_dns_cache_config
Browse files Browse the repository at this point in the history
Support custom `ttl_dns_cache` connector configuration
  • Loading branch information
jakob-keller authored Jan 19, 2025
2 parents bdfbfd5 + c795b0c commit 4e9869b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changes
-------

2.19.0 (2025-01-19)
^^^^^^^^^^^^^^^^^^^
* support custom `ttl_dns_cache` connector configuration

2.18.0 (2025-01-17)
^^^^^^^^^^^^^^^^^^^
* bump botocore dependency specification
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.18.0'
__version__ = '2.19.0'
5 changes: 5 additions & 0 deletions aiobotocore/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ def _validate_connector_args(connector_args):
raise ParamValidationError(
report=f'{k} value must be a boolean'
)
elif k == 'ttl_dns_cache':
if v is not None and not isinstance(v, int):
raise ParamValidationError(
report=f'{k} value must be an int or None'
)
elif k == 'keepalive_timeout':
if v is not None and not isinstance(v, (float, int)):
raise ParamValidationError(
Expand Down
7 changes: 7 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ async def test_connector_args():
connector_args = dict(use_dns_cache=1)
AioConfig(connector_args)

with pytest.raises(ParamValidationError):
# wrong type
connector_args = dict(ttl_dns_cache="1")
AioConfig(connector_args)

with pytest.raises(ParamValidationError):
# wrong type
connector_args = dict(keepalive_timeout="1")
Expand Down Expand Up @@ -48,6 +53,8 @@ async def test_connector_args():
AioConfig(connector_args)

# Test valid configs:
AioConfig({"ttl_dns_cache": None})
AioConfig({"ttl_dns_cache": 1})
AioConfig({"resolver": aiohttp.resolver.DefaultResolver()})
AioConfig({'keepalive_timeout': None})

Expand Down

0 comments on commit 4e9869b

Please sign in to comment.