requests.adapters: use re-exports rather than assignments (#8485)

This commit is contained in:
Kevin Kirsche
2022-08-05 07:46:07 -04:00
committed by GitHub
parent 68f20a4a23
commit 3e88363b34
2 changed files with 32 additions and 29 deletions

View File

@@ -0,0 +1 @@
PySocks>=1.5.6, !=1.5.7

View File

@@ -1,34 +1,36 @@
from collections.abc import Mapping
from typing import Any
from urllib3 import exceptions as urllib3_exceptions, poolmanager, response
from urllib3.util import retry
from urllib3.contrib.socks import SOCKSProxyManager as SOCKSProxyManager
from urllib3.exceptions import (
ConnectTimeoutError as ConnectTimeoutError,
MaxRetryError as MaxRetryError,
ProtocolError as ProtocolError,
ReadTimeoutError as ReadTimeoutError,
ResponseError as ResponseError,
)
from urllib3.poolmanager import PoolManager as PoolManager, proxy_from_url as proxy_from_url
from urllib3.response import HTTPResponse as HTTPResponse
from urllib3.util.retry import Retry as Retry
from . import cookies, exceptions, models, structures, utils
Response = models.Response
PoolManager = poolmanager.PoolManager
proxy_from_url = poolmanager.proxy_from_url
HTTPResponse = response.HTTPResponse
Retry = retry.Retry
DEFAULT_CA_BUNDLE_PATH = utils.DEFAULT_CA_BUNDLE_PATH
get_encoding_from_headers = utils.get_encoding_from_headers
prepend_scheme_if_needed = utils.prepend_scheme_if_needed
get_auth_from_url = utils.get_auth_from_url
urldefragauth = utils.urldefragauth
CaseInsensitiveDict = structures.CaseInsensitiveDict
ConnectTimeoutError = urllib3_exceptions.ConnectTimeoutError
MaxRetryError = urllib3_exceptions.MaxRetryError
ProtocolError = urllib3_exceptions.ProtocolError
ReadTimeoutError = urllib3_exceptions.ReadTimeoutError
ResponseError = urllib3_exceptions.ResponseError
extract_cookies_to_jar = cookies.extract_cookies_to_jar
ConnectionError = exceptions.ConnectionError
ConnectTimeout = exceptions.ConnectTimeout
ReadTimeout = exceptions.ReadTimeout
SSLError = exceptions.SSLError
ProxyError = exceptions.ProxyError
RetryError = exceptions.RetryError
from .cookies import extract_cookies_to_jar as extract_cookies_to_jar
from .exceptions import (
ConnectionError as ConnectionError,
ConnectTimeout as ConnectTimeout,
ProxyError as ProxyError,
ReadTimeout as ReadTimeout,
RetryError as RetryError,
SSLError as SSLError,
)
from .models import PreparedRequest, Response as Response
from .structures import CaseInsensitiveDict as CaseInsensitiveDict
from .utils import (
DEFAULT_CA_BUNDLE_PATH as DEFAULT_CA_BUNDLE_PATH,
get_auth_from_url as get_auth_from_url,
get_encoding_from_headers as get_encoding_from_headers,
prepend_scheme_if_needed as prepend_scheme_if_needed,
urldefragauth as urldefragauth,
)
DEFAULT_POOLBLOCK: bool
DEFAULT_POOLSIZE: int
@@ -39,7 +41,7 @@ class BaseAdapter:
def __init__(self) -> None: ...
def send(
self,
request: models.PreparedRequest,
request: PreparedRequest,
stream: bool = ...,
timeout: None | float | tuple[float, float] | tuple[float, None] = ...,
verify: bool | str = ...,
@@ -68,7 +70,7 @@ class HTTPAdapter(BaseAdapter):
def proxy_headers(self, proxy): ...
def send(
self,
request: models.PreparedRequest,
request: PreparedRequest,
stream: bool = ...,
timeout: None | float | tuple[float, float] | tuple[float, None] = ...,
verify: bool | str = ...,