1 # Stubs for requests.models (Python 3)
\r
3 from typing import (Any, Dict, Iterator, List, MutableMapping, Optional, Text,
\r
9 from . import structures
\r
11 from . import cookies
\r
12 from .cookies import RequestsCookieJar
\r
13 from .packages.urllib3 import fields
\r
14 from .packages.urllib3 import filepost
\r
15 from .packages.urllib3 import util
\r
16 from .packages.urllib3 import exceptions as urllib3_exceptions
\r
17 from . import exceptions
\r
19 from . import compat
\r
20 from . import status_codes
\r
23 default_hooks = hooks.default_hooks
\r
24 CaseInsensitiveDict = structures.CaseInsensitiveDict
\r
25 HTTPBasicAuth = auth.HTTPBasicAuth
\r
26 cookiejar_from_dict = cookies.cookiejar_from_dict
\r
27 get_cookie_header = cookies.get_cookie_header
\r
28 RequestField = fields.RequestField
\r
29 encode_multipart_formdata = filepost.encode_multipart_formdata
\r
30 parse_url = util.parse_url
\r
31 DecodeError = urllib3_exceptions.DecodeError
\r
32 ReadTimeoutError = urllib3_exceptions.ReadTimeoutError
\r
33 ProtocolError = urllib3_exceptions.ProtocolError
\r
34 LocationParseError = urllib3_exceptions.LocationParseError
\r
35 HTTPError = exceptions.HTTPError
\r
36 MissingSchema = exceptions.MissingSchema
\r
37 InvalidURL = exceptions.InvalidURL
\r
38 ChunkedEncodingError = exceptions.ChunkedEncodingError
\r
39 ContentDecodingError = exceptions.ContentDecodingError
\r
40 ConnectionError = exceptions.ConnectionError
\r
41 StreamConsumedError = exceptions.StreamConsumedError
\r
42 guess_filename = utils.guess_filename
\r
43 get_auth_from_url = utils.get_auth_from_url
\r
44 requote_uri = utils.requote_uri
\r
45 stream_decode_response_unicode = utils.stream_decode_response_unicode
\r
46 to_key_val_list = utils.to_key_val_list
\r
47 parse_header_links = utils.parse_header_links
\r
48 iter_slices = utils.iter_slices
\r
49 guess_json_utf = utils.guess_json_utf
\r
50 super_len = utils.super_len
\r
51 to_native_string = utils.to_native_string
\r
52 codes = status_codes.codes
\r
54 REDIRECT_STATI = ... # type: Any
\r
55 DEFAULT_REDIRECT_LIMIT = ... # type: Any
\r
56 CONTENT_CHUNK_SIZE = ... # type: Any
\r
57 ITER_CHUNK_SIZE = ... # type: Any
\r
58 json_dumps = ... # type: Any
\r
60 class RequestEncodingMixin:
\r
62 def path_url(self): ...
\r
64 class RequestHooksMixin:
\r
65 def register_hook(self, event, hook): ...
\r
66 def deregister_hook(self, event, hook): ...
\r
68 class Request(RequestHooksMixin):
\r
69 hooks = ... # type: Any
\r
70 method = ... # type: Any
\r
71 url = ... # type: Any
\r
72 headers = ... # type: Any
\r
73 files = ... # type: Any
\r
74 data = ... # type: Any
\r
75 json = ... # type: Any
\r
76 params = ... # type: Any
\r
77 auth = ... # type: Any
\r
78 cookies = ... # type: Any
\r
79 def __init__(self, method=..., url=..., headers=..., files=..., data=..., params=...,
\r
80 auth=..., cookies=..., hooks=..., json=...) -> None: ...
\r
81 def prepare(self): ...
\r
83 class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
\r
84 method = ... # type: Optional[Union[str, Text]]
\r
85 url = ... # type: Optional[Union[str, Text]]
\r
86 headers = ... # type: CaseInsensitiveDict
\r
87 body = ... # type: Optional[Union[bytes, Text]]
\r
88 hooks = ... # type: Any
\r
89 def __init__(self) -> None: ...
\r
90 def prepare(self, method=..., url=..., headers=..., files=..., data=..., params=...,
\r
91 auth=..., cookies=..., hooks=..., json=...): ...
\r
93 def prepare_method(self, method): ...
\r
94 def prepare_url(self, url, params): ...
\r
95 def prepare_headers(self, headers): ...
\r
96 def prepare_body(self, data, files, json=...): ...
\r
97 def prepare_content_length(self, body): ...
\r
98 def prepare_auth(self, auth, url=...): ...
\r
99 def prepare_cookies(self, cookies): ...
\r
100 def prepare_hooks(self, hooks): ...
\r
103 __attrs__ = ... # type: Any
\r
104 status_code = ... # type: int
\r
105 headers = ... # type: MutableMapping[str, str]
\r
106 raw = ... # type: Any
\r
107 url = ... # type: str
\r
108 encoding = ... # type: str
\r
109 history = ... # type: List[Response]
\r
110 reason = ... # type: str
\r
111 cookies = ... # type: RequestsCookieJar
\r
112 elapsed = ... # type: datetime.timedelta
\r
113 request = ... # type: PreparedRequest
\r
114 def __init__(self) -> None: ...
\r
115 def __bool__(self) -> bool: ...
\r
116 def __nonzero__(self) -> bool: ...
\r
117 def __iter__(self) -> Iterator[bytes]: ...
\r
118 def __enter__(self) -> Response: ...
\r
119 def __exit__(self, *args: Any) -> None: ...
\r
121 def ok(self) -> bool: ...
\r
123 def is_redirect(self) -> bool: ...
\r
125 def is_permanent_redirect(self) -> bool: ...
\r
127 def apparent_encoding(self) -> str: ...
\r
128 def iter_content(self, chunk_size: Optional[int] = ...,
\r
129 decode_unicode: bool = ...) -> Iterator[Any]: ...
\r
130 def iter_lines(self, chunk_size=..., decode_unicode=..., delimiter=...): ...
\r
132 def content(self) -> bytes: ...
\r
134 def text(self) -> str: ...
\r
135 def json(self, **kwargs) -> Any: ...
\r
137 def links(self) -> Dict[Any, Any]: ...
\r
138 def raise_for_status(self) -> None: ...
\r
139 def close(self) -> None: ...
\r