From ee716509084691d8e65593c8e43c496bd3406ea8 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Thu, 13 Jan 2022 13:02:54 -0800 Subject: [PATCH] python: Replace requests.packages.urllib3 alias with urllib3. requests stopped vendoring urllib3 in 2.16.0 (2017-05-26). Signed-off-by: Anders Kaseorg --- pyproject.toml | 1 + tools/fetch-contributor-data | 2 +- .../oneclickapps/prepare_digital_ocean_one_click_app_release.py | 2 +- zerver/lib/outgoing_http.py | 2 +- zerver/management/commands/fetch_tor_exit_nodes.py | 2 +- zerver/tests/test_outgoing_http.py | 2 +- zerver/tornado/django_api.py | 2 +- 7 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d51824e903..4c47b4d61b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,6 +97,7 @@ module = [ "tornado.*", "twitter.*", "two_factor.*", + "urllib3.*", "zxcvbn.*", ] ignore_missing_imports = true diff --git a/tools/fetch-contributor-data b/tools/fetch-contributor-data index 8adc132cfc..63d615cff2 100755 --- a/tools/fetch-contributor-data +++ b/tools/fetch-contributor-data @@ -20,8 +20,8 @@ os.environ["DJANGO_SETTINGS_MODULE"] = "zproject.settings" import django from django.conf import settings -from requests.packages.urllib3.util.retry import Retry from typing_extensions import TypedDict +from urllib3.util import Retry django.setup() diff --git a/tools/oneclickapps/prepare_digital_ocean_one_click_app_release.py b/tools/oneclickapps/prepare_digital_ocean_one_click_app_release.py index d56ce42f11..be5a48c830 100644 --- a/tools/oneclickapps/prepare_digital_ocean_one_click_app_release.py +++ b/tools/oneclickapps/prepare_digital_ocean_one_click_app_release.py @@ -7,7 +7,7 @@ from typing import List import digitalocean import zulip from requests.adapters import HTTPAdapter -from requests.packages.urllib3.util.retry import Retry +from urllib3.util import Retry manager = digitalocean.Manager(token=os.environ["DIGITALOCEAN_API_KEY"]) zulip_client = zulip.Client() diff --git a/zerver/lib/outgoing_http.py b/zerver/lib/outgoing_http.py index 0bd343309a..b6b71b9034 100644 --- a/zerver/lib/outgoing_http.py +++ b/zerver/lib/outgoing_http.py @@ -1,7 +1,7 @@ from typing import Any, Dict, Optional, Union import requests -from requests.packages.urllib3.util.retry import Retry +from urllib3.util import Retry class OutgoingSession(requests.Session): diff --git a/zerver/management/commands/fetch_tor_exit_nodes.py b/zerver/management/commands/fetch_tor_exit_nodes.py index b5299ff48c..7687236ef4 100644 --- a/zerver/management/commands/fetch_tor_exit_nodes.py +++ b/zerver/management/commands/fetch_tor_exit_nodes.py @@ -4,7 +4,7 @@ from typing import Any, Set import orjson from django.conf import settings -from requests.packages.urllib3.util.retry import Retry +from urllib3.util import Retry from zerver.lib.management import ZulipBaseCommand from zerver.lib.outgoing_http import OutgoingSession diff --git a/zerver/tests/test_outgoing_http.py b/zerver/tests/test_outgoing_http.py index f9f6f391d4..8aa2d4fb96 100644 --- a/zerver/tests/test_outgoing_http.py +++ b/zerver/tests/test_outgoing_http.py @@ -4,7 +4,7 @@ from unittest import mock import requests import responses -from requests.packages.urllib3.util.retry import Retry +from urllib3.util import Retry from zerver.lib.outgoing_http import OutgoingSession from zerver.lib.test_classes import ZulipTestCase diff --git a/zerver/tornado/django_api.py b/zerver/tornado/django_api.py index e0ed3a946c..af9d6b9d05 100644 --- a/zerver/tornado/django_api.py +++ b/zerver/tornado/django_api.py @@ -7,7 +7,7 @@ import requests from django.conf import settings from requests.adapters import ConnectionError, HTTPAdapter from requests.models import PreparedRequest, Response -from requests.packages.urllib3.util.retry import Retry +from urllib3.util import Retry from zerver.lib.queue import queue_json_publish from zerver.models import Client, Realm, UserProfile