massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / requests / requests / models.pyi
1 import datetime
2 from json import JSONDecoder
3 from typing import Any, Callable, Iterator, Text, Type
4
5 from . import auth, cookies, exceptions, hooks, status_codes, structures, utils
6 from .cookies import RequestsCookieJar
7 from .packages.urllib3 import exceptions as urllib3_exceptions, fields, filepost, util
8
9 default_hooks = hooks.default_hooks
10 CaseInsensitiveDict = structures.CaseInsensitiveDict
11 HTTPBasicAuth = auth.HTTPBasicAuth
12 cookiejar_from_dict = cookies.cookiejar_from_dict
13 get_cookie_header = cookies.get_cookie_header
14 RequestField = fields.RequestField
15 encode_multipart_formdata = filepost.encode_multipart_formdata
16 parse_url = util.parse_url
17 DecodeError = urllib3_exceptions.DecodeError
18 ReadTimeoutError = urllib3_exceptions.ReadTimeoutError
19 ProtocolError = urllib3_exceptions.ProtocolError
20 LocationParseError = urllib3_exceptions.LocationParseError
21 HTTPError = exceptions.HTTPError
22 MissingSchema = exceptions.MissingSchema
23 InvalidURL = exceptions.InvalidURL
24 ChunkedEncodingError = exceptions.ChunkedEncodingError
25 ContentDecodingError = exceptions.ContentDecodingError
26 ConnectionError = exceptions.ConnectionError
27 StreamConsumedError = exceptions.StreamConsumedError
28 guess_filename = utils.guess_filename
29 get_auth_from_url = utils.get_auth_from_url
30 requote_uri = utils.requote_uri
31 stream_decode_response_unicode = utils.stream_decode_response_unicode
32 to_key_val_list = utils.to_key_val_list
33 parse_header_links = utils.parse_header_links
34 iter_slices = utils.iter_slices
35 guess_json_utf = utils.guess_json_utf
36 super_len = utils.super_len
37 to_native_string = utils.to_native_string
38 codes = status_codes.codes
39
40 REDIRECT_STATI: Any
41 DEFAULT_REDIRECT_LIMIT: Any
42 CONTENT_CHUNK_SIZE: Any
43 ITER_CHUNK_SIZE: Any
44
45 class RequestEncodingMixin:
46     @property
47     def path_url(self): ...
48
49 class RequestHooksMixin:
50     def register_hook(self, event, hook): ...
51     def deregister_hook(self, event, hook): ...
52
53 class Request(RequestHooksMixin):
54     hooks: Any
55     method: Any
56     url: Any
57     headers: Any
58     files: Any
59     data: Any
60     json: Any
61     params: Any
62     auth: Any
63     cookies: Any
64     def __init__(
65         self, method=..., url=..., headers=..., files=..., data=..., params=..., auth=..., cookies=..., hooks=..., json=...
66     ) -> None: ...
67     def prepare(self) -> PreparedRequest: ...
68
69 class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
70     method: str | Text | None
71     url: str | Text | None
72     headers: CaseInsensitiveDict[str]
73     body: bytes | Text | None
74     hooks: Any
75     def __init__(self) -> None: ...
76     def prepare(
77         self, method=..., url=..., headers=..., files=..., data=..., params=..., auth=..., cookies=..., hooks=..., json=...
78     ) -> None: ...
79     def copy(self) -> PreparedRequest: ...
80     def prepare_method(self, method) -> None: ...
81     def prepare_url(self, url, params) -> None: ...
82     def prepare_headers(self, headers) -> None: ...
83     def prepare_body(self, data, files, json=...) -> None: ...
84     def prepare_content_length(self, body) -> None: ...
85     def prepare_auth(self, auth, url=...) -> None: ...
86     def prepare_cookies(self, cookies) -> None: ...
87     def prepare_hooks(self, hooks) -> None: ...
88
89 class Response:
90     __attrs__: Any
91     _content: bytes | None  # undocumented
92     status_code: int
93     headers: CaseInsensitiveDict[str]
94     raw: Any
95     url: str
96     encoding: str | None
97     history: list[Response]
98     reason: str
99     cookies: RequestsCookieJar
100     elapsed: datetime.timedelta
101     request: PreparedRequest
102     def __init__(self) -> None: ...
103     def __bool__(self) -> bool: ...
104     def __nonzero__(self) -> bool: ...
105     def __iter__(self) -> Iterator[bytes]: ...
106     def __enter__(self) -> Response: ...
107     def __exit__(self, *args: Any) -> None: ...
108     @property
109     def next(self) -> PreparedRequest | None: ...
110     @property
111     def ok(self) -> bool: ...
112     @property
113     def is_redirect(self) -> bool: ...
114     @property
115     def is_permanent_redirect(self) -> bool: ...
116     @property
117     def apparent_encoding(self) -> str: ...
118     def iter_content(self, chunk_size: int | None = ..., decode_unicode: bool = ...) -> Iterator[Any]: ...
119     def iter_lines(
120         self, chunk_size: int | None = ..., decode_unicode: bool = ..., delimiter: Text | bytes | None = ...
121     ) -> Iterator[Any]: ...
122     @property
123     def content(self) -> bytes: ...
124     @property
125     def text(self) -> str: ...
126     def json(
127         self,
128         *,
129         cls: Type[JSONDecoder] | None = ...,
130         object_hook: Callable[[dict[Any, Any]], Any] | None = ...,
131         parse_float: Callable[[str], Any] | None = ...,
132         parse_int: Callable[[str], Any] | None = ...,
133         parse_constant: Callable[[str], Any] | None = ...,
134         object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = ...,
135         **kwds: Any,
136     ) -> Any: ...
137     @property
138     def links(self) -> dict[Any, Any]: ...
139     def raise_for_status(self) -> None: ...
140     def close(self) -> None: ...