mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 08:47:39 +08:00
Re-organize directory structure (#4971)
See discussion in #2491 Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
This commit is contained in:
36
stubs/requests/requests/__init__.pyi
Normal file
36
stubs/requests/requests/__init__.pyi
Normal file
@@ -0,0 +1,36 @@
|
||||
import logging
|
||||
from typing import Any, Text
|
||||
|
||||
from .api import (
|
||||
delete as delete,
|
||||
get as get,
|
||||
head as head,
|
||||
options as options,
|
||||
patch as patch,
|
||||
post as post,
|
||||
put as put,
|
||||
request as request,
|
||||
)
|
||||
from .exceptions import (
|
||||
ConnectionError as ConnectionError,
|
||||
HTTPError as HTTPError,
|
||||
ReadTimeout as ReadTimeout,
|
||||
RequestException as RequestException,
|
||||
Timeout as Timeout,
|
||||
TooManyRedirects as TooManyRedirects,
|
||||
URLRequired as URLRequired,
|
||||
)
|
||||
from .models import PreparedRequest as PreparedRequest, Request as Request, Response as Response
|
||||
from .sessions import Session as Session, session as session
|
||||
from .status_codes import codes as codes
|
||||
|
||||
__title__: Any
|
||||
__build__: Any
|
||||
__license__: Any
|
||||
__copyright__: Any
|
||||
__version__: Any
|
||||
|
||||
class NullHandler(logging.Handler):
|
||||
def emit(self, record): ...
|
||||
|
||||
def check_compatibility(urllib3_version: Text, chardet_version: Text) -> None: ...
|
||||
73
stubs/requests/requests/adapters.pyi
Normal file
73
stubs/requests/requests/adapters.pyi
Normal file
@@ -0,0 +1,73 @@
|
||||
from typing import Any, Container, Mapping, Optional, Text, Tuple, Union
|
||||
|
||||
from . import cookies, exceptions, models, structures, utils
|
||||
from .packages.urllib3 import exceptions as urllib3_exceptions, poolmanager, response
|
||||
from .packages.urllib3.util import retry
|
||||
|
||||
PreparedRequest = models.PreparedRequest
|
||||
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
|
||||
|
||||
DEFAULT_POOLBLOCK: Any
|
||||
DEFAULT_POOLSIZE: Any
|
||||
DEFAULT_RETRIES: Any
|
||||
|
||||
class BaseAdapter:
|
||||
def __init__(self) -> None: ...
|
||||
def send(
|
||||
self,
|
||||
request: PreparedRequest,
|
||||
stream: bool = ...,
|
||||
timeout: Union[None, float, Tuple[float, float], Tuple[float, None]] = ...,
|
||||
verify: Union[bool, str] = ...,
|
||||
cert: Union[None, Union[bytes, Text], Container[Union[bytes, Text]]] = ...,
|
||||
proxies: Optional[Mapping[str, str]] = ...,
|
||||
) -> Response: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class HTTPAdapter(BaseAdapter):
|
||||
__attrs__: Any
|
||||
max_retries: Any
|
||||
config: Any
|
||||
proxy_manager: Any
|
||||
def __init__(self, pool_connections=..., pool_maxsize=..., max_retries=..., pool_block=...) -> None: ...
|
||||
poolmanager: Any
|
||||
def init_poolmanager(self, connections, maxsize, block=..., **pool_kwargs): ...
|
||||
def proxy_manager_for(self, proxy, **proxy_kwargs): ...
|
||||
def cert_verify(self, conn, url, verify, cert): ...
|
||||
def build_response(self, req, resp): ...
|
||||
def get_connection(self, url, proxies=...): ...
|
||||
def close(self): ...
|
||||
def request_url(self, request, proxies): ...
|
||||
def add_headers(self, request, **kwargs): ...
|
||||
def proxy_headers(self, proxy): ...
|
||||
def send(
|
||||
self,
|
||||
request: PreparedRequest,
|
||||
stream: bool = ...,
|
||||
timeout: Union[None, float, Tuple[float, float], Tuple[float, None]] = ...,
|
||||
verify: Union[bool, str] = ...,
|
||||
cert: Union[None, Union[bytes, Text], Container[Union[bytes, Text]]] = ...,
|
||||
proxies: Optional[Mapping[str, str]] = ...,
|
||||
) -> Response: ...
|
||||
28
stubs/requests/requests/api.pyi
Normal file
28
stubs/requests/requests/api.pyi
Normal file
@@ -0,0 +1,28 @@
|
||||
from _typeshed import SupportsItems
|
||||
from typing import Iterable, Optional, Text, Tuple, Union
|
||||
|
||||
from .models import Response
|
||||
from .sessions import _Data
|
||||
|
||||
_ParamsMappingKeyType = Union[Text, bytes, int, float]
|
||||
_ParamsMappingValueType = Union[Text, bytes, int, float, Iterable[Union[Text, bytes, int, float]], None]
|
||||
|
||||
def request(method: str, url: str, **kwargs) -> Response: ...
|
||||
def get(
|
||||
url: Union[Text, bytes],
|
||||
params: Optional[
|
||||
Union[
|
||||
SupportsItems[_ParamsMappingKeyType, _ParamsMappingValueType],
|
||||
Tuple[_ParamsMappingKeyType, _ParamsMappingValueType],
|
||||
Iterable[Tuple[_ParamsMappingKeyType, _ParamsMappingValueType]],
|
||||
Union[Text, bytes],
|
||||
]
|
||||
] = ...,
|
||||
**kwargs,
|
||||
) -> Response: ...
|
||||
def options(url: Union[Text, bytes], **kwargs) -> Response: ...
|
||||
def head(url: Union[Text, bytes], **kwargs) -> Response: ...
|
||||
def post(url: Union[Text, bytes], data: _Data = ..., json=..., **kwargs) -> Response: ...
|
||||
def put(url: Union[Text, bytes], data: _Data = ..., json=..., **kwargs) -> Response: ...
|
||||
def patch(url: Union[Text, bytes], data: _Data = ..., json=..., **kwargs) -> Response: ...
|
||||
def delete(url: Union[Text, bytes], **kwargs) -> Response: ...
|
||||
39
stubs/requests/requests/auth.pyi
Normal file
39
stubs/requests/requests/auth.pyi
Normal file
@@ -0,0 +1,39 @@
|
||||
from typing import Any, Text, Union
|
||||
|
||||
from . import cookies, models, status_codes, utils
|
||||
|
||||
extract_cookies_to_jar = cookies.extract_cookies_to_jar
|
||||
parse_dict_header = utils.parse_dict_header
|
||||
to_native_string = utils.to_native_string
|
||||
|
||||
CONTENT_TYPE_FORM_URLENCODED: Any
|
||||
CONTENT_TYPE_MULTI_PART: Any
|
||||
|
||||
def _basic_auth_str(username: Union[bytes, Text], password: Union[bytes, Text]) -> str: ...
|
||||
|
||||
class AuthBase:
|
||||
def __call__(self, r: models.PreparedRequest) -> models.PreparedRequest: ...
|
||||
|
||||
class HTTPBasicAuth(AuthBase):
|
||||
username: Any
|
||||
password: Any
|
||||
def __init__(self, username, password) -> None: ...
|
||||
def __call__(self, r): ...
|
||||
|
||||
class HTTPProxyAuth(HTTPBasicAuth):
|
||||
def __call__(self, r): ...
|
||||
|
||||
class HTTPDigestAuth(AuthBase):
|
||||
username: Any
|
||||
password: Any
|
||||
last_nonce: Any
|
||||
nonce_count: Any
|
||||
chal: Any
|
||||
pos: Any
|
||||
num_401_calls: Any
|
||||
def __init__(self, username, password) -> None: ...
|
||||
def build_digest_header(self, method, url): ...
|
||||
def handle_redirect(self, r, **kwargs): ...
|
||||
def handle_401(self, r, **kwargs): ...
|
||||
def __call__(self, r): ...
|
||||
def init_per_thread_state(self) -> None: ...
|
||||
3
stubs/requests/requests/compat.pyi
Normal file
3
stubs/requests/requests/compat.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
import collections
|
||||
|
||||
OrderedDict = collections.OrderedDict
|
||||
64
stubs/requests/requests/cookies.pyi
Normal file
64
stubs/requests/requests/cookies.pyi
Normal file
@@ -0,0 +1,64 @@
|
||||
import sys
|
||||
from typing import Any, MutableMapping
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
from cookielib import CookieJar
|
||||
else:
|
||||
from http.cookiejar import CookieJar
|
||||
|
||||
class MockRequest:
|
||||
type: Any
|
||||
def __init__(self, request) -> None: ...
|
||||
def get_type(self): ...
|
||||
def get_host(self): ...
|
||||
def get_origin_req_host(self): ...
|
||||
def get_full_url(self): ...
|
||||
def is_unverifiable(self): ...
|
||||
def has_header(self, name): ...
|
||||
def get_header(self, name, default=...): ...
|
||||
def add_header(self, key, val): ...
|
||||
def add_unredirected_header(self, name, value): ...
|
||||
def get_new_headers(self): ...
|
||||
@property
|
||||
def unverifiable(self): ...
|
||||
@property
|
||||
def origin_req_host(self): ...
|
||||
@property
|
||||
def host(self): ...
|
||||
|
||||
class MockResponse:
|
||||
def __init__(self, headers) -> None: ...
|
||||
def info(self): ...
|
||||
def getheaders(self, name): ...
|
||||
|
||||
def extract_cookies_to_jar(jar, request, response): ...
|
||||
def get_cookie_header(jar, request): ...
|
||||
def remove_cookie_by_name(cookiejar, name, domain=..., path=...): ...
|
||||
|
||||
class CookieConflictError(RuntimeError): ...
|
||||
|
||||
class RequestsCookieJar(CookieJar, MutableMapping[Any, Any]):
|
||||
def get(self, name, default=..., domain=..., path=...): ...
|
||||
def set(self, name, value, **kwargs): ...
|
||||
def iterkeys(self): ...
|
||||
def keys(self): ...
|
||||
def itervalues(self): ...
|
||||
def values(self): ...
|
||||
def iteritems(self): ...
|
||||
def items(self): ...
|
||||
def list_domains(self): ...
|
||||
def list_paths(self): ...
|
||||
def multiple_domains(self): ...
|
||||
def get_dict(self, domain=..., path=...): ...
|
||||
def __getitem__(self, name): ...
|
||||
def __setitem__(self, name, value): ...
|
||||
def __delitem__(self, name): ...
|
||||
def set_cookie(self, cookie, *args, **kwargs): ...
|
||||
def update(self, other): ...
|
||||
def copy(self): ...
|
||||
def get_policy(self): ...
|
||||
|
||||
def create_cookie(name, value, **kwargs): ...
|
||||
def morsel_to_cookie(morsel): ...
|
||||
def cookiejar_from_dict(cookie_dict, cookiejar=..., overwrite=...): ...
|
||||
def merge_cookies(cookiejar, cookies): ...
|
||||
31
stubs/requests/requests/exceptions.pyi
Normal file
31
stubs/requests/requests/exceptions.pyi
Normal file
@@ -0,0 +1,31 @@
|
||||
from typing import Any
|
||||
|
||||
from .packages.urllib3.exceptions import HTTPError as BaseHTTPError
|
||||
|
||||
class RequestException(IOError):
|
||||
response: Any
|
||||
request: Any
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
|
||||
class HTTPError(RequestException): ...
|
||||
class ConnectionError(RequestException): ...
|
||||
class ProxyError(ConnectionError): ...
|
||||
class SSLError(ConnectionError): ...
|
||||
class Timeout(RequestException): ...
|
||||
class ConnectTimeout(ConnectionError, Timeout): ...
|
||||
class ReadTimeout(Timeout): ...
|
||||
class URLRequired(RequestException): ...
|
||||
class TooManyRedirects(RequestException): ...
|
||||
class MissingSchema(RequestException, ValueError): ...
|
||||
class InvalidSchema(RequestException, ValueError): ...
|
||||
class InvalidURL(RequestException, ValueError): ...
|
||||
class InvalidHeader(RequestException, ValueError): ...
|
||||
class InvalidProxyURL(InvalidURL): ...
|
||||
class ChunkedEncodingError(RequestException): ...
|
||||
class ContentDecodingError(RequestException, BaseHTTPError): ...
|
||||
class StreamConsumedError(RequestException, TypeError): ...
|
||||
class RetryError(RequestException): ...
|
||||
class UnrewindableBodyError(RequestException): ...
|
||||
class RequestsWarning(Warning): ...
|
||||
class FileModeWarning(RequestsWarning, DeprecationWarning): ...
|
||||
class RequestsDependencyWarning(RequestsWarning): ...
|
||||
6
stubs/requests/requests/hooks.pyi
Normal file
6
stubs/requests/requests/hooks.pyi
Normal file
@@ -0,0 +1,6 @@
|
||||
from typing import Any
|
||||
|
||||
HOOKS: Any
|
||||
|
||||
def default_hooks(): ...
|
||||
def dispatch_hook(key, hooks, hook_data, **kwargs): ...
|
||||
129
stubs/requests/requests/models.pyi
Normal file
129
stubs/requests/requests/models.pyi
Normal file
@@ -0,0 +1,129 @@
|
||||
import datetime
|
||||
from typing import Any, Dict, Iterator, List, Optional, Text, Union
|
||||
|
||||
from . import auth, cookies, exceptions, hooks, status_codes, structures, utils
|
||||
from .cookies import RequestsCookieJar
|
||||
from .packages.urllib3 import exceptions as urllib3_exceptions, fields, filepost, util
|
||||
|
||||
default_hooks = hooks.default_hooks
|
||||
CaseInsensitiveDict = structures.CaseInsensitiveDict
|
||||
HTTPBasicAuth = auth.HTTPBasicAuth
|
||||
cookiejar_from_dict = cookies.cookiejar_from_dict
|
||||
get_cookie_header = cookies.get_cookie_header
|
||||
RequestField = fields.RequestField
|
||||
encode_multipart_formdata = filepost.encode_multipart_formdata
|
||||
parse_url = util.parse_url
|
||||
DecodeError = urllib3_exceptions.DecodeError
|
||||
ReadTimeoutError = urllib3_exceptions.ReadTimeoutError
|
||||
ProtocolError = urllib3_exceptions.ProtocolError
|
||||
LocationParseError = urllib3_exceptions.LocationParseError
|
||||
HTTPError = exceptions.HTTPError
|
||||
MissingSchema = exceptions.MissingSchema
|
||||
InvalidURL = exceptions.InvalidURL
|
||||
ChunkedEncodingError = exceptions.ChunkedEncodingError
|
||||
ContentDecodingError = exceptions.ContentDecodingError
|
||||
ConnectionError = exceptions.ConnectionError
|
||||
StreamConsumedError = exceptions.StreamConsumedError
|
||||
guess_filename = utils.guess_filename
|
||||
get_auth_from_url = utils.get_auth_from_url
|
||||
requote_uri = utils.requote_uri
|
||||
stream_decode_response_unicode = utils.stream_decode_response_unicode
|
||||
to_key_val_list = utils.to_key_val_list
|
||||
parse_header_links = utils.parse_header_links
|
||||
iter_slices = utils.iter_slices
|
||||
guess_json_utf = utils.guess_json_utf
|
||||
super_len = utils.super_len
|
||||
to_native_string = utils.to_native_string
|
||||
codes = status_codes.codes
|
||||
|
||||
REDIRECT_STATI: Any
|
||||
DEFAULT_REDIRECT_LIMIT: Any
|
||||
CONTENT_CHUNK_SIZE: Any
|
||||
ITER_CHUNK_SIZE: Any
|
||||
|
||||
class RequestEncodingMixin:
|
||||
@property
|
||||
def path_url(self): ...
|
||||
|
||||
class RequestHooksMixin:
|
||||
def register_hook(self, event, hook): ...
|
||||
def deregister_hook(self, event, hook): ...
|
||||
|
||||
class Request(RequestHooksMixin):
|
||||
hooks: Any
|
||||
method: Any
|
||||
url: Any
|
||||
headers: Any
|
||||
files: Any
|
||||
data: Any
|
||||
json: Any
|
||||
params: Any
|
||||
auth: Any
|
||||
cookies: Any
|
||||
def __init__(
|
||||
self, method=..., url=..., headers=..., files=..., data=..., params=..., auth=..., cookies=..., hooks=..., json=...
|
||||
) -> None: ...
|
||||
def prepare(self) -> PreparedRequest: ...
|
||||
|
||||
class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
|
||||
method: Optional[Union[str, Text]]
|
||||
url: Optional[Union[str, Text]]
|
||||
headers: CaseInsensitiveDict[str]
|
||||
body: Optional[Union[bytes, Text]]
|
||||
hooks: Any
|
||||
def __init__(self) -> None: ...
|
||||
def prepare(
|
||||
self, method=..., url=..., headers=..., files=..., data=..., params=..., auth=..., cookies=..., hooks=..., json=...
|
||||
) -> None: ...
|
||||
def copy(self) -> PreparedRequest: ...
|
||||
def prepare_method(self, method) -> None: ...
|
||||
def prepare_url(self, url, params) -> None: ...
|
||||
def prepare_headers(self, headers) -> None: ...
|
||||
def prepare_body(self, data, files, json=...) -> None: ...
|
||||
def prepare_content_length(self, body) -> None: ...
|
||||
def prepare_auth(self, auth, url=...) -> None: ...
|
||||
def prepare_cookies(self, cookies) -> None: ...
|
||||
def prepare_hooks(self, hooks) -> None: ...
|
||||
|
||||
class Response:
|
||||
__attrs__: Any
|
||||
_content: Optional[bytes] # undocumented
|
||||
status_code: int
|
||||
headers: CaseInsensitiveDict[str]
|
||||
raw: Any
|
||||
url: str
|
||||
encoding: str
|
||||
history: List[Response]
|
||||
reason: str
|
||||
cookies: RequestsCookieJar
|
||||
elapsed: datetime.timedelta
|
||||
request: PreparedRequest
|
||||
def __init__(self) -> None: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
def __nonzero__(self) -> bool: ...
|
||||
def __iter__(self) -> Iterator[bytes]: ...
|
||||
def __enter__(self) -> Response: ...
|
||||
def __exit__(self, *args: Any) -> None: ...
|
||||
@property
|
||||
def next(self) -> Optional[PreparedRequest]: ...
|
||||
@property
|
||||
def ok(self) -> bool: ...
|
||||
@property
|
||||
def is_redirect(self) -> bool: ...
|
||||
@property
|
||||
def is_permanent_redirect(self) -> bool: ...
|
||||
@property
|
||||
def apparent_encoding(self) -> str: ...
|
||||
def iter_content(self, chunk_size: Optional[int] = ..., decode_unicode: bool = ...) -> Iterator[Any]: ...
|
||||
def iter_lines(
|
||||
self, chunk_size: Optional[int] = ..., decode_unicode: bool = ..., delimiter: Optional[Union[Text, bytes]] = ...
|
||||
) -> Iterator[Any]: ...
|
||||
@property
|
||||
def content(self) -> bytes: ...
|
||||
@property
|
||||
def text(self) -> str: ...
|
||||
def json(self, **kwargs) -> Any: ...
|
||||
@property
|
||||
def links(self) -> Dict[Any, Any]: ...
|
||||
def raise_for_status(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
4
stubs/requests/requests/packages/__init__.pyi
Normal file
4
stubs/requests/requests/packages/__init__.pyi
Normal file
@@ -0,0 +1,4 @@
|
||||
class VendorAlias:
|
||||
def __init__(self, package_names) -> None: ...
|
||||
def find_module(self, fullname, path=...): ...
|
||||
def load_module(self, name): ...
|
||||
26
stubs/requests/requests/packages/urllib3/__init__.pyi
Normal file
26
stubs/requests/requests/packages/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=...): ...
|
||||
52
stubs/requests/requests/packages/urllib3/_collections.pyi
Normal file
52
stubs/requests/requests/packages/urllib3/_collections.pyi
Normal file
@@ -0,0 +1,52 @@
|
||||
from collections import MutableMapping
|
||||
from typing import Any, 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=...): ...
|
||||
65
stubs/requests/requests/packages/urllib3/connection.pyi
Normal file
65
stubs/requests/requests/packages/urllib3/connection.pyi
Normal file
@@ -0,0 +1,65 @@
|
||||
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 httplib import HTTPConnection as _HTTPConnection, HTTPException as HTTPException
|
||||
class ConnectionError(Exception): ...
|
||||
|
||||
else:
|
||||
from builtins import ConnectionError as ConnectionError
|
||||
from http.client import HTTPConnection as _HTTPConnection, HTTPException as HTTPException
|
||||
|
||||
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/requests/requests/packages/urllib3/connectionpool.pyi
Normal file
121
stubs/requests/requests/packages/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): ...
|
||||
50
stubs/requests/requests/packages/urllib3/exceptions.pyi
Normal file
50
stubs/requests/requests/packages/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/requests/requests/packages/urllib3/fields.pyi
Normal file
13
stubs/requests/requests/packages/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/requests/requests/packages/urllib3/filepost.pyi
Normal file
12
stubs/requests/requests/packages/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,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/requests/requests/packages/urllib3/poolmanager.pyi
Normal file
28
stubs/requests/requests/packages/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/requests/requests/packages/urllib3/request.pyi
Normal file
11
stubs/requests/requests/packages/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/requests/requests/packages/urllib3/response.pyi
Normal file
66
stubs/requests/requests/packages/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/requests/requests/packages/urllib3/util/__init__.pyi
Normal file
20
stubs/requests/requests/packages/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
|
||||
@@ -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/requests/requests/packages/urllib3/util/request.pyi
Normal file
11
stubs/requests/requests/packages/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=...
|
||||
): ...
|
||||
@@ -0,0 +1 @@
|
||||
def is_fp_closed(obj): ...
|
||||
43
stubs/requests/requests/packages/urllib3/util/retry.pyi
Normal file
43
stubs/requests/requests/packages/urllib3/util/retry.pyi
Normal file
@@ -0,0 +1,43 @@
|
||||
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=...,
|
||||
method_whitelist=...,
|
||||
status_forcelist=...,
|
||||
backoff_factor=...,
|
||||
raise_on_redirect=...,
|
||||
_observed_errors=...,
|
||||
) -> 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/requests/requests/packages/urllib3/util/ssl_.pyi
Normal file
30
stubs/requests/requests/packages/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/requests/requests/packages/urllib3/util/timeout.pyi
Normal file
21
stubs/requests/requests/packages/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/requests/requests/packages/urllib3/util/url.pyi
Normal file
23
stubs/requests/requests/packages/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): ...
|
||||
101
stubs/requests/requests/sessions.pyi
Normal file
101
stubs/requests/requests/sessions.pyi
Normal file
@@ -0,0 +1,101 @@
|
||||
from typing import IO, Any, Callable, Iterable, List, Mapping, MutableMapping, Optional, Text, Tuple, Union
|
||||
|
||||
from . import adapters, auth as _auth, compat, cookies, exceptions, hooks, models, status_codes, structures, utils
|
||||
from .models import Response
|
||||
from .packages.urllib3 import _collections
|
||||
|
||||
BaseAdapter = adapters.BaseAdapter
|
||||
OrderedDict = compat.OrderedDict
|
||||
cookiejar_from_dict = cookies.cookiejar_from_dict
|
||||
extract_cookies_to_jar = cookies.extract_cookies_to_jar
|
||||
RequestsCookieJar = cookies.RequestsCookieJar
|
||||
merge_cookies = cookies.merge_cookies
|
||||
Request = models.Request
|
||||
PreparedRequest = models.PreparedRequest
|
||||
DEFAULT_REDIRECT_LIMIT = models.DEFAULT_REDIRECT_LIMIT
|
||||
default_hooks = hooks.default_hooks
|
||||
dispatch_hook = hooks.dispatch_hook
|
||||
to_key_val_list = utils.to_key_val_list
|
||||
default_headers = utils.default_headers
|
||||
to_native_string = utils.to_native_string
|
||||
TooManyRedirects = exceptions.TooManyRedirects
|
||||
InvalidSchema = exceptions.InvalidSchema
|
||||
ChunkedEncodingError = exceptions.ChunkedEncodingError
|
||||
ContentDecodingError = exceptions.ContentDecodingError
|
||||
RecentlyUsedContainer = _collections.RecentlyUsedContainer
|
||||
CaseInsensitiveDict = structures.CaseInsensitiveDict
|
||||
HTTPAdapter = adapters.HTTPAdapter
|
||||
requote_uri = utils.requote_uri
|
||||
get_environ_proxies = utils.get_environ_proxies
|
||||
get_netrc_auth = utils.get_netrc_auth
|
||||
should_bypass_proxies = utils.should_bypass_proxies
|
||||
get_auth_from_url = utils.get_auth_from_url
|
||||
codes = status_codes.codes
|
||||
REDIRECT_STATI = models.REDIRECT_STATI
|
||||
|
||||
def merge_setting(request_setting, session_setting, dict_class=...): ...
|
||||
def merge_hooks(request_hooks, session_hooks, dict_class=...): ...
|
||||
|
||||
class SessionRedirectMixin:
|
||||
def resolve_redirects(self, resp, req, stream=..., timeout=..., verify=..., cert=..., proxies=...): ...
|
||||
def rebuild_auth(self, prepared_request, response): ...
|
||||
def rebuild_proxies(self, prepared_request, proxies): ...
|
||||
|
||||
_Data = Union[None, Text, bytes, Mapping[str, Any], Mapping[Text, Any], Iterable[Tuple[Text, Optional[Text]]], IO]
|
||||
|
||||
_Hook = Callable[[Response], Any]
|
||||
_Hooks = MutableMapping[Text, List[_Hook]]
|
||||
_HooksInput = MutableMapping[Text, Union[Iterable[_Hook], _Hook]]
|
||||
|
||||
class Session(SessionRedirectMixin):
|
||||
__attrs__: Any
|
||||
headers: CaseInsensitiveDict[Text]
|
||||
auth: Union[None, Tuple[Text, Text], _auth.AuthBase, Callable[[Request], Request]]
|
||||
proxies: MutableMapping[Text, Text]
|
||||
hooks: _Hooks
|
||||
params: Union[bytes, MutableMapping[Text, Text]]
|
||||
stream: bool
|
||||
verify: Union[None, bool, Text]
|
||||
cert: Union[None, Text, Tuple[Text, Text]]
|
||||
max_redirects: int
|
||||
trust_env: bool
|
||||
cookies: RequestsCookieJar
|
||||
adapters: MutableMapping[Any, Any]
|
||||
redirect_cache: RecentlyUsedContainer[Any, Any]
|
||||
def __init__(self) -> None: ...
|
||||
def __enter__(self) -> Session: ...
|
||||
def __exit__(self, *args) -> None: ...
|
||||
def prepare_request(self, request): ...
|
||||
def request(
|
||||
self,
|
||||
method: str,
|
||||
url: Union[str, bytes, Text],
|
||||
params: Union[None, bytes, MutableMapping[Text, Text]] = ...,
|
||||
data: _Data = ...,
|
||||
headers: Optional[MutableMapping[Text, Text]] = ...,
|
||||
cookies: Union[None, RequestsCookieJar, MutableMapping[Text, Text]] = ...,
|
||||
files: Optional[MutableMapping[Text, IO[Any]]] = ...,
|
||||
auth: Union[None, Tuple[Text, Text], _auth.AuthBase, Callable[[Request], Request]] = ...,
|
||||
timeout: Union[None, float, Tuple[float, float], Tuple[float, None]] = ...,
|
||||
allow_redirects: Optional[bool] = ...,
|
||||
proxies: Optional[MutableMapping[Text, Text]] = ...,
|
||||
hooks: Optional[_HooksInput] = ...,
|
||||
stream: Optional[bool] = ...,
|
||||
verify: Union[None, bool, Text] = ...,
|
||||
cert: Union[Text, Tuple[Text, Text], None] = ...,
|
||||
json: Optional[Any] = ...,
|
||||
) -> Response: ...
|
||||
def get(self, url: Union[Text, bytes], **kwargs) -> Response: ...
|
||||
def options(self, url: Union[Text, bytes], **kwargs) -> Response: ...
|
||||
def head(self, url: Union[Text, bytes], **kwargs) -> Response: ...
|
||||
def post(self, url: Union[Text, bytes], data: _Data = ..., json: Optional[Any] = ..., **kwargs) -> Response: ...
|
||||
def put(self, url: Union[Text, bytes], data: _Data = ..., **kwargs) -> Response: ...
|
||||
def patch(self, url: Union[Text, bytes], data: _Data = ..., **kwargs) -> Response: ...
|
||||
def delete(self, url: Union[Text, bytes], **kwargs) -> Response: ...
|
||||
def send(self, request: PreparedRequest, **kwargs) -> Response: ...
|
||||
def merge_environment_settings(self, url, proxies, stream, verify, cert): ...
|
||||
def get_adapter(self, url): ...
|
||||
def close(self) -> None: ...
|
||||
def mount(self, prefix: Union[Text, bytes], adapter: BaseAdapter) -> None: ...
|
||||
|
||||
def session() -> Session: ...
|
||||
3
stubs/requests/requests/status_codes.pyi
Normal file
3
stubs/requests/requests/status_codes.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
from typing import Any
|
||||
|
||||
codes: Any
|
||||
20
stubs/requests/requests/structures.pyi
Normal file
20
stubs/requests/requests/structures.pyi
Normal file
@@ -0,0 +1,20 @@
|
||||
from typing import Any, Dict, Generic, Iterable, Iterator, Mapping, MutableMapping, Optional, Tuple, TypeVar, Union
|
||||
|
||||
_VT = TypeVar("_VT")
|
||||
|
||||
class CaseInsensitiveDict(MutableMapping[str, _VT], Generic[_VT]):
|
||||
def __init__(self, data: Optional[Union[Mapping[str, _VT], Iterable[Tuple[str, _VT]]]] = ..., **kwargs: _VT) -> None: ...
|
||||
def lower_items(self) -> Iterator[Tuple[str, _VT]]: ...
|
||||
def __setitem__(self, key: str, value: _VT) -> None: ...
|
||||
def __getitem__(self, key: str) -> _VT: ...
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def __len__(self) -> int: ...
|
||||
def copy(self) -> CaseInsensitiveDict[_VT]: ...
|
||||
|
||||
class LookupDict(Dict[str, _VT]):
|
||||
name: Any
|
||||
def __init__(self, name: Any = ...) -> None: ...
|
||||
def __getitem__(self, key: str) -> Optional[_VT]: ... # type: ignore
|
||||
def __getattr__(self, attr: str) -> _VT: ...
|
||||
def __setattr__(self, attr: str, value: _VT) -> None: ...
|
||||
54
stubs/requests/requests/utils.pyi
Normal file
54
stubs/requests/requests/utils.pyi
Normal file
@@ -0,0 +1,54 @@
|
||||
from typing import Any, AnyStr, Dict, Iterable, Mapping, Optional, Text, Tuple
|
||||
|
||||
from . import compat, cookies, exceptions, structures
|
||||
|
||||
OrderedDict = compat.OrderedDict
|
||||
RequestsCookieJar = cookies.RequestsCookieJar
|
||||
cookiejar_from_dict = cookies.cookiejar_from_dict
|
||||
CaseInsensitiveDict = structures.CaseInsensitiveDict
|
||||
InvalidURL = exceptions.InvalidURL
|
||||
|
||||
NETRC_FILES: Any
|
||||
DEFAULT_CA_BUNDLE_PATH: Any
|
||||
DEFAULT_PORTS: Any
|
||||
|
||||
def dict_to_sequence(d): ...
|
||||
def super_len(o): ...
|
||||
def get_netrc_auth(url, raise_errors: bool = ...): ...
|
||||
def guess_filename(obj): ...
|
||||
def extract_zipped_paths(path): ...
|
||||
def from_key_val_list(value): ...
|
||||
def to_key_val_list(value): ...
|
||||
def parse_list_header(value): ...
|
||||
def parse_dict_header(value): ...
|
||||
def unquote_header_value(value, is_filename=...): ...
|
||||
def dict_from_cookiejar(cj): ...
|
||||
def add_dict_to_cookiejar(cj, cookie_dict): ...
|
||||
def get_encodings_from_content(content): ...
|
||||
def get_encoding_from_headers(headers): ...
|
||||
def stream_decode_response_unicode(iterator, r): ...
|
||||
def iter_slices(string, slice_length): ...
|
||||
def get_unicode_from_response(r): ...
|
||||
|
||||
UNRESERVED_SET: Any
|
||||
|
||||
def unquote_unreserved(uri): ...
|
||||
def requote_uri(uri): ...
|
||||
def address_in_network(ip, net): ...
|
||||
def dotted_netmask(mask): ...
|
||||
def is_ipv4_address(string_ip): ...
|
||||
def is_valid_cidr(string_network): ...
|
||||
def set_environ(env_name, value): ...
|
||||
def should_bypass_proxies(url, no_proxy: Optional[Iterable[AnyStr]]) -> bool: ...
|
||||
def get_environ_proxies(url, no_proxy: Optional[Iterable[AnyStr]] = ...) -> Dict[Any, Any]: ...
|
||||
def select_proxy(url: Text, proxies: Optional[Mapping[Any, Any]]): ...
|
||||
def default_user_agent(name=...): ...
|
||||
def default_headers(): ...
|
||||
def parse_header_links(value): ...
|
||||
def guess_json_utf(data): ...
|
||||
def prepend_scheme_if_needed(url, new_scheme): ...
|
||||
def get_auth_from_url(url): ...
|
||||
def to_native_string(string, encoding=...): ...
|
||||
def urldefragauth(url): ...
|
||||
def rewind_body(prepared_request): ...
|
||||
def check_header_validity(header: Tuple[AnyStr, AnyStr]) -> None: ...
|
||||
Reference in New Issue
Block a user