massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 3 / http / client.pyi
1 from typing import (\r
2     Any, Dict, IO, Iterable, List, Iterator, Mapping, Optional, Tuple, Type, TypeVar,\r
3     Union,\r
4     overload,\r
5     BinaryIO,\r
6 )\r
7 import email.message\r
8 import io\r
9 from socket import socket\r
10 import sys\r
11 import ssl\r
12 import types\r
13 \r
14 _DataType = Union[bytes, IO[Any], Iterable[bytes], str]\r
15 _T = TypeVar('_T')\r
16 \r
17 HTTP_PORT = ...  # type: int\r
18 HTTPS_PORT = ...  # type: int\r
19 \r
20 CONTINUE = ...  # type: int\r
21 SWITCHING_PROTOCOLS = ...  # type: int\r
22 PROCESSING = ...  # type: int\r
23 \r
24 OK = ...  # type: int\r
25 CREATED = ...  # type: int\r
26 ACCEPTED = ...  # type: int\r
27 NON_AUTHORITATIVE_INFORMATION = ...  # type: int\r
28 NO_CONTENT = ...  # type: int\r
29 RESET_CONTENT = ...  # type: int\r
30 PARTIAL_CONTENT = ...  # type: int\r
31 MULTI_STATUS = ...  # type: int\r
32 IM_USED = ...  # type: int\r
33 \r
34 MULTIPLE_CHOICES = ...  # type: int\r
35 MOVED_PERMANENTLY = ...  # type: int\r
36 FOUND = ...  # type: int\r
37 SEE_OTHER = ...  # type: int\r
38 NOT_MODIFIED = ...  # type: int\r
39 USE_PROXY = ...  # type: int\r
40 TEMPORARY_REDIRECT = ...  # type: int\r
41 \r
42 BAD_REQUEST = ...  # type: int\r
43 UNAUTHORIZED = ...  # type: int\r
44 PAYMENT_REQUIRED = ...  # type: int\r
45 FORBIDDEN = ...  # type: int\r
46 NOT_FOUND = ...  # type: int\r
47 METHOD_NOT_ALLOWED = ...  # type: int\r
48 NOT_ACCEPTABLE = ...  # type: int\r
49 PROXY_AUTHENTICATION_REQUIRED = ...  # type: int\r
50 REQUEST_TIMEOUT = ...  # type: int\r
51 CONFLICT = ...  # type: int\r
52 GONE = ...  # type: int\r
53 LENGTH_REQUIRED = ...  # type: int\r
54 PRECONDITION_FAILED = ...  # type: int\r
55 REQUEST_ENTITY_TOO_LARGE = ...  # type: int\r
56 REQUEST_URI_TOO_LONG = ...  # type: int\r
57 UNSUPPORTED_MEDIA_TYPE = ...  # type: int\r
58 REQUESTED_RANGE_NOT_SATISFIABLE = ...  # type: int\r
59 EXPECTATION_FAILED = ...  # type: int\r
60 UNPROCESSABLE_ENTITY = ...  # type: int\r
61 LOCKED = ...  # type: int\r
62 FAILED_DEPENDENCY = ...  # type: int\r
63 UPGRADE_REQUIRED = ...  # type: int\r
64 PRECONDITION_REQUIRED = ...  # type: int\r
65 TOO_MANY_REQUESTS = ...  # type: int\r
66 REQUEST_HEADER_FIELDS_TOO_LARGE = ...  # type: int\r
67 \r
68 INTERNAL_SERVER_ERROR = ...  # type: int\r
69 NOT_IMPLEMENTED = ...  # type: int\r
70 BAD_GATEWAY = ...  # type: int\r
71 SERVICE_UNAVAILABLE = ...  # type: int\r
72 GATEWAY_TIMEOUT = ...  # type: int\r
73 HTTP_VERSION_NOT_SUPPORTED = ...  # type: int\r
74 INSUFFICIENT_STORAGE = ...  # type: int\r
75 NOT_EXTENDED = ...  # type: int\r
76 NETWORK_AUTHENTICATION_REQUIRED = ...  # type: int\r
77 \r
78 responses = ...  # type: Dict[int, str]\r
79 \r
80 class HTTPMessage(email.message.Message): ...\r
81 \r
82 if sys.version_info >= (3, 5):\r
83     # Ignore errors to work around python/mypy#5027\r
84     class HTTPResponse(io.BufferedIOBase, BinaryIO):  # type: ignore\r
85         msg = ...  # type: HTTPMessage\r
86         headers = ...  # type: HTTPMessage\r
87         version = ...  # type: int\r
88         debuglevel = ...  # type: int\r
89         closed = ...  # type: bool\r
90         status = ...  # type: int\r
91         reason = ...  # type: str\r
92         def __init__(self, sock: socket, debuglevel: int = ...,\r
93                      method: Optional[str] = ..., url: Optional[str] = ...) -> None: ...\r
94         def read(self, amt: Optional[int] = ...) -> bytes: ...\r
95         @overload\r
96         def getheader(self, name: str) -> Optional[str]: ...\r
97         @overload\r
98         def getheader(self, name: str, default: _T) -> Union[str, _T]: ...\r
99         def getheaders(self) -> List[Tuple[str, str]]: ...\r
100         def fileno(self) -> int: ...\r
101         def isclosed(self) -> bool: ...\r
102         def __iter__(self) -> Iterator[bytes]: ...\r
103         def __enter__(self) -> 'HTTPResponse': ...\r
104         def __exit__(self, exc_type: Optional[Type[BaseException]],\r
105                      exc_val: Optional[BaseException],\r
106                      exc_tb: Optional[types.TracebackType]) -> bool: ...\r
107 else:\r
108     class HTTPResponse(io.RawIOBase, BinaryIO):  # type: ignore\r
109         msg = ...  # type: HTTPMessage\r
110         headers = ...  # type: HTTPMessage\r
111         version = ...  # type: int\r
112         debuglevel = ...  # type: int\r
113         closed = ...  # type: bool\r
114         status = ...  # type: int\r
115         reason = ...  # type: str\r
116         def read(self, amt: Optional[int] = ...) -> bytes: ...\r
117         def readinto(self, b: bytearray) -> int: ...\r
118         @overload\r
119         def getheader(self, name: str) -> Optional[str]: ...\r
120         @overload\r
121         def getheader(self, name: str, default: _T) -> Union[str, _T]: ...\r
122         def getheaders(self) -> List[Tuple[str, str]]: ...\r
123         def fileno(self) -> int: ...\r
124         def __iter__(self) -> Iterator[bytes]: ...\r
125         def __enter__(self) -> 'HTTPResponse': ...\r
126         def __exit__(self, exc_type: Optional[Type[BaseException]],\r
127                      exc_val: Optional[BaseException],\r
128                      exc_tb: Optional[types.TracebackType]) -> bool: ...\r
129 \r
130 class HTTPConnection:\r
131     if sys.version_info >= (3, 7):\r
132         def __init__(\r
133             self,\r
134             host: str, port: Optional[int] = ...,\r
135             timeout: int = ...,\r
136             source_address: Optional[Tuple[str, int]] = ..., blocksize: int = ...\r
137         ) -> None: ...\r
138     else:\r
139         def __init__(\r
140             self,\r
141             host: str, port: Optional[int] = ...,\r
142             timeout: int = ...,\r
143             source_address: Optional[Tuple[str, int]] = ...\r
144         ) -> None: ...\r
145     def request(self, method: str, url: str,\r
146                 body: Optional[_DataType] = ...,\r
147                 headers: Mapping[str, str] = ...) -> None: ...\r
148     def getresponse(self) -> HTTPResponse: ...\r
149     def set_debuglevel(self, level: int) -> None: ...\r
150     def set_tunnel(self, host: str, port: Optional[int] = ...,\r
151                    headers: Optional[Mapping[str, str]] = ...) -> None: ...\r
152     def connect(self) -> None: ...\r
153     def close(self) -> None: ...\r
154     def putrequest(self, request: str, selector: str, skip_host: bool = ...,\r
155                    skip_accept_encoding: bool = ...) -> None: ...\r
156     def putheader(self, header: str, *argument: str) -> None: ...\r
157     def endheaders(self, message_body: Optional[_DataType] = ...) -> None: ...\r
158     def send(self, data: _DataType) -> None: ...\r
159 \r
160 class HTTPSConnection(HTTPConnection):\r
161     def __init__(self,\r
162                  host: str, port: Optional[int] = ...,\r
163                  key_file: Optional[str] = ...,\r
164                  cert_file: Optional[str] = ...,\r
165                  timeout: int = ...,\r
166                  source_address: Optional[Tuple[str, int]] = ...,\r
167                  *, context: Optional[ssl.SSLContext] = ...,\r
168                  check_hostname: Optional[bool] = ...) -> None: ...\r
169 \r
170 class HTTPException(Exception): ...\r
171 error = HTTPException\r
172 \r
173 class NotConnected(HTTPException): ...\r
174 class InvalidURL(HTTPException): ...\r
175 class UnknownProtocol(HTTPException): ...\r
176 class UnknownTransferEncoding(HTTPException): ...\r
177 class UnimplementedFileMode(HTTPException): ...\r
178 class IncompleteRead(HTTPException): ...\r
179 \r
180 class ImproperConnectionState(HTTPException): ...\r
181 class CannotSendRequest(ImproperConnectionState): ...\r
182 class CannotSendHeader(ImproperConnectionState): ...\r
183 class ResponseNotReady(ImproperConnectionState): ...\r
184 \r
185 class BadStatusLine(HTTPException): ...\r
186 class LineTooLong(HTTPException): ...\r
187 \r
188 if sys.version_info >= (3, 5):\r
189     class RemoteDisconnected(ConnectionResetError, BadStatusLine): ...\r