mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Add urllib3 stubs (#6858)
This commit is contained in:
@@ -63,6 +63,7 @@
|
||||
"stubs/SQLAlchemy",
|
||||
"stubs/stripe",
|
||||
"stubs/ttkthemes",
|
||||
"stubs/urllib3",
|
||||
"stubs/vobject"
|
||||
],
|
||||
"typeCheckingMode": "basic",
|
||||
|
||||
59
stubs/urllib3/@tests/stubtest_allowlist.txt
Normal file
59
stubs/urllib3/@tests/stubtest_allowlist.txt
Normal file
@@ -0,0 +1,59 @@
|
||||
urllib3.HTTPConnectionPool.__init__
|
||||
urllib3.HTTPConnectionPool.urlopen
|
||||
urllib3.HTTPResponse.__init__
|
||||
urllib3.HTTPSConnectionPool.__init__
|
||||
urllib3.NullHandler
|
||||
urllib3.PoolManager.connection_from_host
|
||||
urllib3.PoolManager.connection_from_url
|
||||
urllib3.PoolManager.urlopen
|
||||
urllib3.ProxyManager.__init__
|
||||
urllib3.ProxyManager.connection_from_host
|
||||
urllib3.ProxyManager.urlopen
|
||||
urllib3.Retry.is_forced_retry
|
||||
urllib3.Retry.sleep
|
||||
urllib3._collections.HTTPHeaderDict.from_httplib
|
||||
urllib3._collections.HTTPHeaderDict.getlist
|
||||
urllib3._collections.RLock
|
||||
urllib3.connection.HTTPConnection.request
|
||||
urllib3.connection.HTTPSConnection.__init__
|
||||
urllib3.connection.VerifiedHTTPSConnection.__init__
|
||||
urllib3.connection.VerifiedHTTPSConnection.set_cert
|
||||
urllib3.connectionpool.ConnectionError
|
||||
urllib3.connectionpool.HTTPConnection.request
|
||||
urllib3.connectionpool.HTTPConnectionPool.__init__
|
||||
urllib3.connectionpool.HTTPConnectionPool.urlopen
|
||||
urllib3.connectionpool.HTTPResponse.__init__
|
||||
urllib3.connectionpool.HTTPSConnection.__init__
|
||||
urllib3.connectionpool.HTTPSConnectionPool.__init__
|
||||
urllib3.connectionpool.ProxyError.__init__
|
||||
urllib3.connectionpool.RequestMethods.request_encode_url
|
||||
urllib3.connectionpool.Retry.is_forced_retry
|
||||
urllib3.connectionpool.Retry.sleep
|
||||
urllib3.connectionpool.VerifiedHTTPSConnection.__init__
|
||||
urllib3.connectionpool.VerifiedHTTPSConnection.set_cert
|
||||
urllib3.exceptions.ProxyError.__init__
|
||||
urllib3.fields.RequestField.__init__
|
||||
urllib3.fields.RequestField.from_tuples
|
||||
urllib3.filepost.RequestField.__init__
|
||||
urllib3.filepost.RequestField.from_tuples
|
||||
urllib3.packages.ssl_match_hostname
|
||||
urllib3.packages.ssl_match_hostname._implementation
|
||||
urllib3.poolmanager.PoolManager.connection_from_host
|
||||
urllib3.poolmanager.PoolManager.connection_from_url
|
||||
urllib3.poolmanager.PoolManager.urlopen
|
||||
urllib3.poolmanager.ProxyManager.__init__
|
||||
urllib3.poolmanager.ProxyManager.connection_from_host
|
||||
urllib3.poolmanager.ProxyManager.urlopen
|
||||
urllib3.request.RequestMethods.request_encode_url
|
||||
urllib3.response.HTTPHeaderDict.from_httplib
|
||||
urllib3.response.HTTPHeaderDict.getlist
|
||||
urllib3.response.HTTPResponse.__init__
|
||||
urllib3.response.PY3
|
||||
urllib3.util.Retry.is_forced_retry
|
||||
urllib3.util.Retry.sleep
|
||||
urllib3.util.connection.poll
|
||||
urllib3.util.connection.select
|
||||
urllib3.util.retry.Retry.is_forced_retry
|
||||
urllib3.util.retry.Retry.sleep
|
||||
urllib3.util.ssl_.create_default_context
|
||||
urllib3.util.ssl_.ssl_wrap_socket
|
||||
1
stubs/urllib3/METADATA.toml
Normal file
1
stubs/urllib3/METADATA.toml
Normal file
@@ -0,0 +1 @@
|
||||
version = "1.26.*"
|
||||
26
stubs/urllib3/urllib3/__init__.pyi
Normal file
26
stubs/urllib3/urllib3/__init__.pyi
Normal file
@@ -0,0 +1,26 @@
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from . import connectionpool, filepost, poolmanager, response
|
||||
from .util import request as _request, retry, timeout, url
|
||||
|
||||
__license__: Any
|
||||
|
||||
HTTPConnectionPool = connectionpool.HTTPConnectionPool
|
||||
HTTPSConnectionPool = connectionpool.HTTPSConnectionPool
|
||||
connection_from_url = connectionpool.connection_from_url
|
||||
encode_multipart_formdata = filepost.encode_multipart_formdata
|
||||
PoolManager = poolmanager.PoolManager
|
||||
ProxyManager = poolmanager.ProxyManager
|
||||
proxy_from_url = poolmanager.proxy_from_url
|
||||
HTTPResponse = response.HTTPResponse
|
||||
make_headers = _request.make_headers
|
||||
get_host = url.get_host
|
||||
Timeout = timeout.Timeout
|
||||
Retry = retry.Retry
|
||||
|
||||
class NullHandler(logging.Handler):
|
||||
def emit(self, record): ...
|
||||
|
||||
def add_stderr_logger(level=...): ...
|
||||
def disable_warnings(category=...): ...
|
||||
51
stubs/urllib3/urllib3/_collections.pyi
Normal file
51
stubs/urllib3/urllib3/_collections.pyi
Normal file
@@ -0,0 +1,51 @@
|
||||
from typing import Any, MutableMapping, NoReturn, TypeVar
|
||||
|
||||
_KT = TypeVar("_KT")
|
||||
_VT = TypeVar("_VT")
|
||||
|
||||
class RLock:
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, exc_type, exc_value, traceback): ...
|
||||
|
||||
class RecentlyUsedContainer(MutableMapping[_KT, _VT]):
|
||||
ContainerCls: Any
|
||||
dispose_func: Any
|
||||
lock: Any
|
||||
def __init__(self, maxsize=..., dispose_func=...) -> None: ...
|
||||
def __getitem__(self, key): ...
|
||||
def __setitem__(self, key, value): ...
|
||||
def __delitem__(self, key): ...
|
||||
def __len__(self): ...
|
||||
def __iter__(self): ...
|
||||
def clear(self): ...
|
||||
def keys(self): ...
|
||||
|
||||
class HTTPHeaderDict(MutableMapping[str, str]):
|
||||
def __init__(self, headers=..., **kwargs) -> None: ...
|
||||
def __setitem__(self, key, val): ...
|
||||
def __getitem__(self, key): ...
|
||||
def __delitem__(self, key): ...
|
||||
def __contains__(self, key): ...
|
||||
def __eq__(self, other): ...
|
||||
def __iter__(self) -> NoReturn: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __ne__(self, other): ...
|
||||
values: Any
|
||||
get: Any
|
||||
update: Any
|
||||
iterkeys: Any
|
||||
itervalues: Any
|
||||
def pop(self, key, default=...): ...
|
||||
def discard(self, key): ...
|
||||
def add(self, key, val): ...
|
||||
def extend(self, *args, **kwargs): ...
|
||||
def getlist(self, key): ...
|
||||
getheaders: Any
|
||||
getallmatchingheaders: Any
|
||||
iget: Any
|
||||
def copy(self): ...
|
||||
def iteritems(self): ...
|
||||
def itermerged(self): ...
|
||||
def items(self): ...
|
||||
@classmethod
|
||||
def from_httplib(cls, message, duplicates=...): ...
|
||||
64
stubs/urllib3/urllib3/connection.pyi
Normal file
64
stubs/urllib3/urllib3/connection.pyi
Normal file
@@ -0,0 +1,64 @@
|
||||
import ssl
|
||||
import sys
|
||||
from typing import Any
|
||||
|
||||
from . import exceptions, util
|
||||
from .packages import ssl_match_hostname
|
||||
from .util import ssl_
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
from builtins import ConnectionError as ConnectionError
|
||||
from http.client import HTTPConnection as _HTTPConnection, HTTPException as HTTPException
|
||||
else:
|
||||
from httplib import HTTPConnection as _HTTPConnection, HTTPException as HTTPException
|
||||
class ConnectionError(Exception): ...
|
||||
|
||||
class DummyConnection: ...
|
||||
|
||||
BaseSSLError = ssl.SSLError
|
||||
|
||||
ConnectTimeoutError = exceptions.ConnectTimeoutError
|
||||
SystemTimeWarning = exceptions.SystemTimeWarning
|
||||
SecurityWarning = exceptions.SecurityWarning
|
||||
match_hostname = ssl_match_hostname.match_hostname
|
||||
resolve_cert_reqs = ssl_.resolve_cert_reqs
|
||||
resolve_ssl_version = ssl_.resolve_ssl_version
|
||||
ssl_wrap_socket = ssl_.ssl_wrap_socket
|
||||
assert_fingerprint = ssl_.assert_fingerprint
|
||||
connection = util.connection
|
||||
|
||||
port_by_scheme: Any
|
||||
RECENT_DATE: Any
|
||||
|
||||
class HTTPConnection(_HTTPConnection):
|
||||
default_port: Any
|
||||
default_socket_options: Any
|
||||
is_verified: Any
|
||||
source_address: Any
|
||||
socket_options: Any
|
||||
def __init__(self, *args, **kw) -> None: ...
|
||||
def connect(self): ...
|
||||
|
||||
class HTTPSConnection(HTTPConnection):
|
||||
default_port: Any
|
||||
key_file: Any
|
||||
cert_file: Any
|
||||
def __init__(self, host, port=..., key_file=..., cert_file=..., strict=..., timeout=..., **kw) -> None: ...
|
||||
sock: Any
|
||||
def connect(self): ...
|
||||
|
||||
class VerifiedHTTPSConnection(HTTPSConnection):
|
||||
cert_reqs: Any
|
||||
ca_certs: Any
|
||||
ssl_version: Any
|
||||
assert_fingerprint: Any
|
||||
key_file: Any
|
||||
cert_file: Any
|
||||
assert_hostname: Any
|
||||
def set_cert(self, key_file=..., cert_file=..., cert_reqs=..., ca_certs=..., assert_hostname=..., assert_fingerprint=...): ...
|
||||
sock: Any
|
||||
auto_open: Any
|
||||
is_verified: Any
|
||||
def connect(self): ...
|
||||
|
||||
UnverifiedHTTPSConnection = HTTPSConnection
|
||||
121
stubs/urllib3/urllib3/connectionpool.pyi
Normal file
121
stubs/urllib3/urllib3/connectionpool.pyi
Normal file
@@ -0,0 +1,121 @@
|
||||
from typing import Any
|
||||
|
||||
from . import connection, exceptions, request, response
|
||||
from .connection import BaseSSLError as BaseSSLError, ConnectionError as ConnectionError, HTTPException as HTTPException
|
||||
from .packages import ssl_match_hostname
|
||||
from .util import connection as _connection, retry, timeout, url
|
||||
|
||||
ClosedPoolError = exceptions.ClosedPoolError
|
||||
ProtocolError = exceptions.ProtocolError
|
||||
EmptyPoolError = exceptions.EmptyPoolError
|
||||
HostChangedError = exceptions.HostChangedError
|
||||
LocationValueError = exceptions.LocationValueError
|
||||
MaxRetryError = exceptions.MaxRetryError
|
||||
ProxyError = exceptions.ProxyError
|
||||
ReadTimeoutError = exceptions.ReadTimeoutError
|
||||
SSLError = exceptions.SSLError
|
||||
TimeoutError = exceptions.TimeoutError
|
||||
InsecureRequestWarning = exceptions.InsecureRequestWarning
|
||||
CertificateError = ssl_match_hostname.CertificateError
|
||||
port_by_scheme = connection.port_by_scheme
|
||||
DummyConnection = connection.DummyConnection
|
||||
HTTPConnection = connection.HTTPConnection
|
||||
HTTPSConnection = connection.HTTPSConnection
|
||||
VerifiedHTTPSConnection = connection.VerifiedHTTPSConnection
|
||||
RequestMethods = request.RequestMethods
|
||||
HTTPResponse = response.HTTPResponse
|
||||
is_connection_dropped = _connection.is_connection_dropped
|
||||
Retry = retry.Retry
|
||||
Timeout = timeout.Timeout
|
||||
get_host = url.get_host
|
||||
|
||||
xrange: Any
|
||||
log: Any
|
||||
|
||||
class ConnectionPool:
|
||||
scheme: Any
|
||||
QueueCls: Any
|
||||
host: Any
|
||||
port: Any
|
||||
def __init__(self, host, port=...) -> None: ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, exc_type, exc_val, exc_tb): ...
|
||||
def close(self): ...
|
||||
|
||||
class HTTPConnectionPool(ConnectionPool, RequestMethods):
|
||||
scheme: Any
|
||||
ConnectionCls: Any
|
||||
strict: Any
|
||||
timeout: Any
|
||||
retries: Any
|
||||
pool: Any
|
||||
block: Any
|
||||
proxy: Any
|
||||
proxy_headers: Any
|
||||
num_connections: Any
|
||||
num_requests: Any
|
||||
conn_kw: Any
|
||||
def __init__(
|
||||
self,
|
||||
host,
|
||||
port=...,
|
||||
strict=...,
|
||||
timeout=...,
|
||||
maxsize=...,
|
||||
block=...,
|
||||
headers=...,
|
||||
retries=...,
|
||||
_proxy=...,
|
||||
_proxy_headers=...,
|
||||
**conn_kw,
|
||||
) -> None: ...
|
||||
def close(self): ...
|
||||
def is_same_host(self, url): ...
|
||||
def urlopen(
|
||||
self,
|
||||
method,
|
||||
url,
|
||||
body=...,
|
||||
headers=...,
|
||||
retries=...,
|
||||
redirect=...,
|
||||
assert_same_host=...,
|
||||
timeout=...,
|
||||
pool_timeout=...,
|
||||
release_conn=...,
|
||||
**response_kw,
|
||||
): ...
|
||||
|
||||
class HTTPSConnectionPool(HTTPConnectionPool):
|
||||
scheme: Any
|
||||
ConnectionCls: Any
|
||||
key_file: Any
|
||||
cert_file: Any
|
||||
cert_reqs: Any
|
||||
ca_certs: Any
|
||||
ssl_version: Any
|
||||
assert_hostname: Any
|
||||
assert_fingerprint: Any
|
||||
def __init__(
|
||||
self,
|
||||
host,
|
||||
port=...,
|
||||
strict=...,
|
||||
timeout=...,
|
||||
maxsize=...,
|
||||
block=...,
|
||||
headers=...,
|
||||
retries=...,
|
||||
_proxy=...,
|
||||
_proxy_headers=...,
|
||||
key_file=...,
|
||||
cert_file=...,
|
||||
cert_reqs=...,
|
||||
ca_certs=...,
|
||||
ssl_version=...,
|
||||
assert_hostname=...,
|
||||
assert_fingerprint=...,
|
||||
**conn_kw,
|
||||
) -> None: ...
|
||||
|
||||
def connection_from_url(url, **kw): ...
|
||||
0
stubs/urllib3/urllib3/contrib/__init__.pyi
Normal file
0
stubs/urllib3/urllib3/contrib/__init__.pyi
Normal file
50
stubs/urllib3/urllib3/exceptions.pyi
Normal file
50
stubs/urllib3/urllib3/exceptions.pyi
Normal file
@@ -0,0 +1,50 @@
|
||||
from typing import Any
|
||||
|
||||
class HTTPError(Exception): ...
|
||||
class HTTPWarning(Warning): ...
|
||||
|
||||
class PoolError(HTTPError):
|
||||
pool: Any
|
||||
def __init__(self, pool, message) -> None: ...
|
||||
def __reduce__(self): ...
|
||||
|
||||
class RequestError(PoolError):
|
||||
url: Any
|
||||
def __init__(self, pool, url, message) -> None: ...
|
||||
def __reduce__(self): ...
|
||||
|
||||
class SSLError(HTTPError): ...
|
||||
class ProxyError(HTTPError): ...
|
||||
class DecodeError(HTTPError): ...
|
||||
class ProtocolError(HTTPError): ...
|
||||
|
||||
ConnectionError: Any
|
||||
|
||||
class MaxRetryError(RequestError):
|
||||
reason: Any
|
||||
def __init__(self, pool, url, reason=...) -> None: ...
|
||||
|
||||
class HostChangedError(RequestError):
|
||||
retries: Any
|
||||
def __init__(self, pool, url, retries=...) -> None: ...
|
||||
|
||||
class TimeoutStateError(HTTPError): ...
|
||||
class TimeoutError(HTTPError): ...
|
||||
class ReadTimeoutError(TimeoutError, RequestError): ...
|
||||
class ConnectTimeoutError(TimeoutError): ...
|
||||
class EmptyPoolError(PoolError): ...
|
||||
class ClosedPoolError(PoolError): ...
|
||||
class LocationValueError(ValueError, HTTPError): ...
|
||||
|
||||
class LocationParseError(LocationValueError):
|
||||
location: Any
|
||||
def __init__(self, location) -> None: ...
|
||||
|
||||
class ResponseError(HTTPError):
|
||||
GENERIC_ERROR: Any
|
||||
SPECIFIC_ERROR: Any
|
||||
|
||||
class SecurityWarning(HTTPWarning): ...
|
||||
class InsecureRequestWarning(SecurityWarning): ...
|
||||
class SystemTimeWarning(SecurityWarning): ...
|
||||
class InsecurePlatformWarning(SecurityWarning): ...
|
||||
13
stubs/urllib3/urllib3/fields.pyi
Normal file
13
stubs/urllib3/urllib3/fields.pyi
Normal file
@@ -0,0 +1,13 @@
|
||||
from typing import Any
|
||||
|
||||
def guess_content_type(filename, default=...): ...
|
||||
def format_header_param(name, value): ...
|
||||
|
||||
class RequestField:
|
||||
data: Any
|
||||
headers: Any
|
||||
def __init__(self, name, data, filename=..., headers=...) -> None: ...
|
||||
@classmethod
|
||||
def from_tuples(cls, fieldname, value): ...
|
||||
def render_headers(self): ...
|
||||
def make_multipart(self, content_disposition=..., content_type=..., content_location=...): ...
|
||||
12
stubs/urllib3/urllib3/filepost.pyi
Normal file
12
stubs/urllib3/urllib3/filepost.pyi
Normal file
@@ -0,0 +1,12 @@
|
||||
from typing import Any
|
||||
|
||||
from . import fields
|
||||
|
||||
RequestField = fields.RequestField
|
||||
|
||||
writer: Any
|
||||
|
||||
def choose_boundary(): ...
|
||||
def iter_field_objects(fields): ...
|
||||
def iter_fields(fields): ...
|
||||
def encode_multipart_formdata(fields, boundary=...): ...
|
||||
0
stubs/urllib3/urllib3/packages/__init__.pyi
Normal file
0
stubs/urllib3/urllib3/packages/__init__.pyi
Normal file
@@ -0,0 +1,4 @@
|
||||
import ssl
|
||||
|
||||
CertificateError = ssl.CertificateError
|
||||
match_hostname = ssl.match_hostname
|
||||
@@ -0,0 +1,3 @@
|
||||
class CertificateError(ValueError): ...
|
||||
|
||||
def match_hostname(cert, hostname): ...
|
||||
28
stubs/urllib3/urllib3/poolmanager.pyi
Normal file
28
stubs/urllib3/urllib3/poolmanager.pyi
Normal file
@@ -0,0 +1,28 @@
|
||||
from typing import Any
|
||||
|
||||
from .request import RequestMethods
|
||||
|
||||
class PoolManager(RequestMethods):
|
||||
proxy: Any
|
||||
connection_pool_kw: Any
|
||||
pools: Any
|
||||
def __init__(self, num_pools=..., headers=..., **connection_pool_kw) -> None: ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, exc_type, exc_val, exc_tb): ...
|
||||
def clear(self): ...
|
||||
def connection_from_host(self, host, port=..., scheme=...): ...
|
||||
def connection_from_url(self, url): ...
|
||||
# TODO: This was the original signature -- copied another one from base class to fix complaint.
|
||||
# def urlopen(self, method, url, redirect=True, **kw): ...
|
||||
def urlopen(self, method, url, body=..., headers=..., encode_multipart=..., multipart_boundary=..., **kw): ...
|
||||
|
||||
class ProxyManager(PoolManager):
|
||||
proxy: Any
|
||||
proxy_headers: Any
|
||||
def __init__(self, proxy_url, num_pools=..., headers=..., proxy_headers=..., **connection_pool_kw) -> None: ...
|
||||
def connection_from_host(self, host, port=..., scheme=...): ...
|
||||
# TODO: This was the original signature -- copied another one from base class to fix complaint.
|
||||
# def urlopen(self, method, url, redirect=True, **kw): ...
|
||||
def urlopen(self, method, url, body=..., headers=..., encode_multipart=..., multipart_boundary=..., **kw): ...
|
||||
|
||||
def proxy_from_url(url, **kw): ...
|
||||
11
stubs/urllib3/urllib3/request.pyi
Normal file
11
stubs/urllib3/urllib3/request.pyi
Normal file
@@ -0,0 +1,11 @@
|
||||
from typing import Any
|
||||
|
||||
class RequestMethods:
|
||||
headers: Any
|
||||
def __init__(self, headers=...) -> None: ...
|
||||
def urlopen(self, method, url, body=..., headers=..., encode_multipart=..., multipart_boundary=..., **kw): ...
|
||||
def request(self, method, url, fields=..., headers=..., **urlopen_kw): ...
|
||||
def request_encode_url(self, method, url, fields=..., **urlopen_kw): ...
|
||||
def request_encode_body(
|
||||
self, method, url, fields=..., headers=..., encode_multipart=..., multipart_boundary=..., **urlopen_kw
|
||||
): ...
|
||||
66
stubs/urllib3/urllib3/response.pyi
Normal file
66
stubs/urllib3/urllib3/response.pyi
Normal file
@@ -0,0 +1,66 @@
|
||||
import io
|
||||
from typing import Any
|
||||
|
||||
from . import _collections, exceptions
|
||||
from .connection import BaseSSLError as BaseSSLError, HTTPException as HTTPException
|
||||
from .util import response
|
||||
|
||||
HTTPHeaderDict = _collections.HTTPHeaderDict
|
||||
ProtocolError = exceptions.ProtocolError
|
||||
DecodeError = exceptions.DecodeError
|
||||
ReadTimeoutError = exceptions.ReadTimeoutError
|
||||
binary_type = bytes # six.binary_type
|
||||
PY3 = True # six.PY3
|
||||
is_fp_closed = response.is_fp_closed
|
||||
|
||||
class DeflateDecoder:
|
||||
def __init__(self) -> None: ...
|
||||
def __getattr__(self, name): ...
|
||||
def decompress(self, data): ...
|
||||
|
||||
class GzipDecoder:
|
||||
def __init__(self) -> None: ...
|
||||
def __getattr__(self, name): ...
|
||||
def decompress(self, data): ...
|
||||
|
||||
class HTTPResponse(io.IOBase):
|
||||
CONTENT_DECODERS: Any
|
||||
REDIRECT_STATUSES: Any
|
||||
headers: Any
|
||||
status: Any
|
||||
version: Any
|
||||
reason: Any
|
||||
strict: Any
|
||||
decode_content: Any
|
||||
def __init__(
|
||||
self,
|
||||
body=...,
|
||||
headers=...,
|
||||
status=...,
|
||||
version=...,
|
||||
reason=...,
|
||||
strict=...,
|
||||
preload_content=...,
|
||||
decode_content=...,
|
||||
original_response=...,
|
||||
pool=...,
|
||||
connection=...,
|
||||
) -> None: ...
|
||||
def get_redirect_location(self): ...
|
||||
def release_conn(self): ...
|
||||
@property
|
||||
def data(self): ...
|
||||
def tell(self): ...
|
||||
def read(self, amt=..., decode_content=..., cache_content=...): ...
|
||||
def stream(self, amt=..., decode_content=...): ...
|
||||
@classmethod
|
||||
def from_httplib(cls, r, **response_kw): ...
|
||||
def getheaders(self): ...
|
||||
def getheader(self, name, default=...): ...
|
||||
def close(self): ...
|
||||
@property
|
||||
def closed(self): ...
|
||||
def fileno(self): ...
|
||||
def flush(self): ...
|
||||
def readable(self): ...
|
||||
def readinto(self, b): ...
|
||||
20
stubs/urllib3/urllib3/util/__init__.pyi
Normal file
20
stubs/urllib3/urllib3/util/__init__.pyi
Normal file
@@ -0,0 +1,20 @@
|
||||
import ssl
|
||||
|
||||
from . import connection, request, response, retry, ssl_, timeout, url
|
||||
|
||||
is_connection_dropped = connection.is_connection_dropped
|
||||
make_headers = request.make_headers
|
||||
is_fp_closed = response.is_fp_closed
|
||||
SSLContext = ssl.SSLContext
|
||||
HAS_SNI = ssl_.HAS_SNI
|
||||
assert_fingerprint = ssl_.assert_fingerprint
|
||||
resolve_cert_reqs = ssl_.resolve_cert_reqs
|
||||
resolve_ssl_version = ssl_.resolve_ssl_version
|
||||
ssl_wrap_socket = ssl_.ssl_wrap_socket
|
||||
current_time = timeout.current_time
|
||||
Timeout = timeout.Timeout
|
||||
Retry = retry.Retry
|
||||
get_host = url.get_host
|
||||
parse_url = url.parse_url
|
||||
split_first = url.split_first
|
||||
Url = url.Url
|
||||
8
stubs/urllib3/urllib3/util/connection.pyi
Normal file
8
stubs/urllib3/urllib3/util/connection.pyi
Normal file
@@ -0,0 +1,8 @@
|
||||
from typing import Any
|
||||
|
||||
poll: Any
|
||||
select: Any
|
||||
HAS_IPV6: bool
|
||||
|
||||
def is_connection_dropped(conn): ...
|
||||
def create_connection(address, timeout=..., source_address=..., socket_options=...): ...
|
||||
11
stubs/urllib3/urllib3/util/request.pyi
Normal file
11
stubs/urllib3/urllib3/util/request.pyi
Normal file
@@ -0,0 +1,11 @@
|
||||
from typing import Any
|
||||
|
||||
# from ..packages import six
|
||||
|
||||
# b = six.b
|
||||
|
||||
ACCEPT_ENCODING: Any
|
||||
|
||||
def make_headers(
|
||||
keep_alive=..., accept_encoding=..., user_agent=..., basic_auth=..., proxy_basic_auth=..., disable_cache=...
|
||||
): ...
|
||||
1
stubs/urllib3/urllib3/util/response.pyi
Normal file
1
stubs/urllib3/urllib3/util/response.pyi
Normal file
@@ -0,0 +1 @@
|
||||
def is_fp_closed(obj): ...
|
||||
49
stubs/urllib3/urllib3/util/retry.pyi
Normal file
49
stubs/urllib3/urllib3/util/retry.pyi
Normal file
@@ -0,0 +1,49 @@
|
||||
from typing import Any
|
||||
|
||||
from .. import exceptions
|
||||
|
||||
ConnectTimeoutError = exceptions.ConnectTimeoutError
|
||||
MaxRetryError = exceptions.MaxRetryError
|
||||
ProtocolError = exceptions.ProtocolError
|
||||
ReadTimeoutError = exceptions.ReadTimeoutError
|
||||
ResponseError = exceptions.ResponseError
|
||||
|
||||
log: Any
|
||||
|
||||
class Retry:
|
||||
DEFAULT_METHOD_WHITELIST: Any
|
||||
BACKOFF_MAX: Any
|
||||
total: Any
|
||||
connect: Any
|
||||
read: Any
|
||||
redirect: Any
|
||||
status_forcelist: Any
|
||||
method_whitelist: Any
|
||||
backoff_factor: Any
|
||||
raise_on_redirect: Any
|
||||
def __init__(
|
||||
self,
|
||||
total=...,
|
||||
connect=...,
|
||||
read=...,
|
||||
redirect=...,
|
||||
status=...,
|
||||
other=...,
|
||||
allowed_methods=...,
|
||||
status_forcelist=...,
|
||||
backoff_factor=...,
|
||||
raise_on_redirect=...,
|
||||
raise_on_status=...,
|
||||
history=...,
|
||||
respect_retry_after_header=...,
|
||||
remove_headers_on_redirect=...,
|
||||
method_whitelist=...,
|
||||
) -> None: ...
|
||||
def new(self, **kw): ...
|
||||
@classmethod
|
||||
def from_int(cls, retries, redirect=..., default=...): ...
|
||||
def get_backoff_time(self): ...
|
||||
def sleep(self): ...
|
||||
def is_forced_retry(self, method, status_code): ...
|
||||
def is_exhausted(self): ...
|
||||
def increment(self, method=..., url=..., response=..., error=..., _pool=..., _stacktrace=...): ...
|
||||
30
stubs/urllib3/urllib3/util/ssl_.pyi
Normal file
30
stubs/urllib3/urllib3/util/ssl_.pyi
Normal file
@@ -0,0 +1,30 @@
|
||||
import ssl
|
||||
from typing import Any
|
||||
|
||||
from .. import exceptions
|
||||
|
||||
SSLError = exceptions.SSLError
|
||||
InsecurePlatformWarning = exceptions.InsecurePlatformWarning
|
||||
SSLContext = ssl.SSLContext
|
||||
|
||||
HAS_SNI: Any
|
||||
create_default_context: Any
|
||||
OP_NO_SSLv2: Any
|
||||
OP_NO_SSLv3: Any
|
||||
OP_NO_COMPRESSION: Any
|
||||
|
||||
def assert_fingerprint(cert, fingerprint): ...
|
||||
def resolve_cert_reqs(candidate): ...
|
||||
def resolve_ssl_version(candidate): ...
|
||||
def create_urllib3_context(ssl_version=..., cert_reqs=..., options=..., ciphers=...): ...
|
||||
def ssl_wrap_socket(
|
||||
sock,
|
||||
keyfile=...,
|
||||
certfile=...,
|
||||
cert_reqs=...,
|
||||
ca_certs=...,
|
||||
server_hostname=...,
|
||||
ssl_version=...,
|
||||
ciphers=...,
|
||||
ssl_context=...,
|
||||
): ...
|
||||
21
stubs/urllib3/urllib3/util/timeout.pyi
Normal file
21
stubs/urllib3/urllib3/util/timeout.pyi
Normal file
@@ -0,0 +1,21 @@
|
||||
from typing import Any
|
||||
|
||||
from .. import exceptions
|
||||
|
||||
TimeoutStateError = exceptions.TimeoutStateError
|
||||
|
||||
def current_time(): ...
|
||||
|
||||
class Timeout:
|
||||
DEFAULT_TIMEOUT: Any
|
||||
total: Any
|
||||
def __init__(self, total=..., connect=..., read=...) -> None: ...
|
||||
@classmethod
|
||||
def from_float(cls, timeout): ...
|
||||
def clone(self): ...
|
||||
def start_connect(self): ...
|
||||
def get_connect_duration(self): ...
|
||||
@property
|
||||
def connect_timeout(self): ...
|
||||
@property
|
||||
def read_timeout(self): ...
|
||||
23
stubs/urllib3/urllib3/util/url.pyi
Normal file
23
stubs/urllib3/urllib3/util/url.pyi
Normal file
@@ -0,0 +1,23 @@
|
||||
from typing import Any
|
||||
|
||||
from .. import exceptions
|
||||
|
||||
LocationParseError = exceptions.LocationParseError
|
||||
|
||||
url_attrs: Any
|
||||
|
||||
class Url:
|
||||
slots: Any
|
||||
def __new__(cls, scheme=..., auth=..., host=..., port=..., path=..., query=..., fragment=...): ...
|
||||
@property
|
||||
def hostname(self): ...
|
||||
@property
|
||||
def request_uri(self): ...
|
||||
@property
|
||||
def netloc(self): ...
|
||||
@property
|
||||
def url(self): ...
|
||||
|
||||
def split_first(s, delims): ...
|
||||
def parse_url(url): ...
|
||||
def get_host(url): ...
|
||||
Reference in New Issue
Block a user