From e52263b75a47414fdfe405547d75cfad5f5df654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Mon, 15 Feb 2021 12:00:06 +0100 Subject: [PATCH] fix: urllib3.__version__ may not have a patch number fix https://github.com/MISP/PyMISP/issues/698 --- pymisp/api.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pymisp/api.py b/pymisp/api.py index 6188000..110ed61 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -94,7 +94,12 @@ def brotli_supported() -> bool: """ # urllib >= 1.25.1 includes brotli support - major, minor, patch = urllib3.__version__.split('.') # noqa: F811 + version_splitted = urllib3.__version__.split('.') # noqa: F811 + if len(version_splitted) == 2: + major, minor = version_splitted + patch = 0 + else: + major, minor, patch = version_splitted major, minor, patch = int(major), int(minor), int(patch) urllib3_with_brotli = (major == 1 and ((minor == 25 and patch >= 1) or (minor >= 26))) or major >= 2