diff --git a/aws_lambda_powertools/utilities/streaming/compat.py b/aws_lambda_powertools/utilities/streaming/compat.py index 383edb8b70a..531c7c6e7fa 100644 --- a/aws_lambda_powertools/utilities/streaming/compat.py +++ b/aws_lambda_powertools/utilities/streaming/compat.py @@ -7,7 +7,6 @@ this file completely. See https://docs.aws.amazon.com/lambda/latest/dg/lambda-python.html. """ import logging -from distutils.version import StrictVersion from io import IOBase from typing import Optional @@ -24,7 +23,11 @@ logger = logging.getLogger(__name__) -if StrictVersion(botocore.__version__) < StrictVersion("1.29.13"): # noqa: C901 +# Splitting the botocore version string into major, minor, and patch versions, +# and performing a conditional check based on the extracted versions. +major, minor, patch = map(int, botocore.__version__.split(".")) + +if major == 1 and (minor < 29 or patch < 13): class PowertoolsStreamingBody(IOBase): """Wrapper class for a HTTP response body.