From 23e415ca5537d8de824ced2ef630fbee968a8d86 Mon Sep 17 00:00:00 2001 From: Adrien Barbaresi Date: Tue, 7 Mar 2023 12:49:58 +0100 Subject: [PATCH] mypy: deal with urllib3 --- .github/workflows/tests.yml | 2 +- courlan/network.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 67ed44e..76d9973 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -75,7 +75,7 @@ jobs: - name: Type checking with mypy if: ${{ matrix.python-version != 'pypy3.8' }} run: | - python -m pip install --upgrade mypy + python -m pip install --upgrade mypy types-urllib3 mypy -p courlan - name: Test with pytest diff --git a/courlan/network.py b/courlan/network.py index 39eb227..fa95acd 100644 --- a/courlan/network.py +++ b/courlan/network.py @@ -7,7 +7,7 @@ import logging -import urllib3 # type: ignore +import urllib3 LOGGER = logging.getLogger(__name__) @@ -38,7 +38,7 @@ def redirection_test(url: str) -> str: # "User-Agent" : str(sample(settings.USER_AGENTS, 1)), # select a random user agent # }) try: - rhead = HTTP_POOL.request("HEAD", url) + rhead = HTTP_POOL.request("HEAD", url) # type:ignore[no-untyped-call] except Exception as err: LOGGER.exception("unknown error: %s %s", url, err) else: