3 from typing import Any, AnyStr, Dict, List, Union, Optional, Mapping, Callable, Sequence, Tuple, Type
\r
4 from urllib import addinfourl
\r
5 from httplib import HTTPResponse
\r
7 _string = Union[str, unicode]
\r
9 class URLError(IOError):
\r
10 reason = ... # type: Union[str, BaseException]
\r
12 class HTTPError(URLError, addinfourl):
\r
13 code = ... # type: int
\r
14 headers = ... # type: Dict[str, str]
\r
16 class Request(object):
\r
17 host = ... # type: str
\r
18 port = ... # type: str
\r
19 data = ... # type: str
\r
20 headers = ... # type: Dict[str, str]
\r
21 unverifiable = ... # type: bool
\r
22 type = ... # type: Optional[str]
\r
23 origin_req_host = ...
\r
24 unredirected_hdrs = ...
\r
26 def __init__(self, url: str, data: Optional[str] = ..., headers: Dict[str, str] = ...,
\r
27 origin_req_host: Optional[str] = ..., unverifiable: bool = ...) -> None: ...
\r
28 def __getattr__(self, attr): ...
\r
29 def get_method(self) -> str: ...
\r
30 def add_data(self, data) -> None: ...
\r
31 def has_data(self) -> bool: ...
\r
32 def get_data(self) -> str: ...
\r
33 def get_full_url(self) -> str: ...
\r
34 def get_type(self): ...
\r
35 def get_host(self) -> str: ...
\r
36 def get_selector(self): ...
\r
37 def set_proxy(self, host, type) -> None: ...
\r
38 def has_proxy(self) -> bool: ...
\r
39 def get_origin_req_host(self) -> str: ...
\r
40 def is_unverifiable(self) -> bool: ...
\r
41 def add_header(self, key: str, val: str) -> None: ...
\r
42 def add_unredirected_header(self, key: str, val: str) -> None: ...
\r
43 def has_header(self, header_name: str) -> bool: ...
\r
44 def get_header(self, header_name: str, default: Optional[str] = ...) -> str: ...
\r
45 def header_items(self): ...
\r
47 class OpenerDirector(object):
\r
48 def add_handler(self, handler: BaseHandler) -> None: ...
\r
49 def open(self, url: Union[Request, _string], data: Optional[_string] = ..., timeout: int = ...): ...
\r
50 def error(self, proto: _string, *args: Any): ...
\r
52 def urlopen(url: Union[Request, _string], data: Optional[_string] = ..., timeout: int = ...,
\r
53 cafile: Optional[_string] = ..., capath: Optional[_string] = ..., cadefault: bool = ...,
\r
54 context: Optional[ssl.SSLContext] = ...): ...
\r
55 def install_opener(opener: OpenerDirector) -> None: ...
\r
56 def build_opener(*handlers: Union[BaseHandler, Type[BaseHandler]]) -> OpenerDirector: ...
\r
59 handler_order = ... # type: int
\r
60 parent = ... # type: OpenerDirector
\r
62 def add_parent(self, parent: OpenerDirector) -> None: ...
\r
63 def close(self) -> None: ...
\r
64 def __lt__(self, other: Any) -> bool: ...
\r
66 class HTTPErrorProcessor(BaseHandler):
\r
67 def http_response(self, request, response): ...
\r
69 class HTTPDefaultErrorHandler(BaseHandler):
\r
70 def http_error_default(self, req, fp, code, msg, hdrs): ...
\r
72 class HTTPRedirectHandler(BaseHandler):
\r
73 max_repeats = ... # type: int
\r
74 max_redirections = ... # type: int
\r
75 def redirect_request(self, req, fp, code, msg, headers, newurl): ...
\r
76 def http_error_301(self, req, fp, code, msg, headers): ...
\r
77 def http_error_302(self, req, fp, code, msg, headers): ...
\r
78 def http_error_303(self, req, fp, code, msg, headers): ...
\r
79 def http_error_307(self, req, fp, code, msg, headers): ...
\r
80 inf_msg = ... # type: str
\r
83 class ProxyHandler(BaseHandler):
\r
84 def __init__(self, proxies=None): ...
\r
85 def proxy_open(self, req, proxy, type): ...
\r
87 class HTTPPasswordMgr:
\r
88 def __init__(self) -> None: ...
\r
89 def add_password(self, realm: _string, uri: Union[_string, Sequence[_string]], user: _string, passwd: _string) -> None: ...
\r
90 def find_user_password(self, realm: _string, authuri: _string) -> Tuple[Any, Any]: ...
\r
91 def reduce_uri(self, uri: _string, default_port: bool = ...) -> Tuple[Any, Any]: ...
\r
92 def is_suburi(self, base: _string, test: _string) -> bool: ...
\r
94 class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr): ...
\r
96 class AbstractBasicAuthHandler:
\r
97 def __init__(self, password_mgr: Optional[HTTPPasswordMgr] = ...) -> None: ...
\r
98 def http_error_auth_reqed(self, authreq, host, req, headers): ...
\r
99 def retry_http_basic_auth(self, host, req, realm): ...
\r
101 class HTTPBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler):
\r
102 auth_header = ... # type: str
\r
103 def http_error_401(self, req, fp, code, msg, headers): ...
\r
105 class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler):
\r
106 auth_header = ... # type: str
\r
107 def http_error_407(self, req, fp, code, msg, headers): ...
\r
109 class AbstractDigestAuthHandler:
\r
110 def __init__(self, passwd: Optional[HTTPPasswordMgr] = ...) -> None: ...
\r
111 def reset_retry_count(self) -> None: ...
\r
112 def http_error_auth_reqed(self, auth_header: str, host: str, req: Request,
\r
113 headers: Mapping[str, str]) -> None: ...
\r
114 def retry_http_digest_auth(self, req: Request, auth: str) -> Optional[HTTPResponse]: ...
\r
115 def get_cnonce(self, nonce: str) -> str: ...
\r
116 def get_authorization(self, req: Request, chal: Mapping[str, str]) -> str: ...
\r
117 def get_algorithm_impls(self, algorithm: str) -> Tuple[Callable[[str], str], Callable[[str, str], str]]: ...
\r
118 def get_entity_digest(self, data: Optional[bytes], chal: Mapping[str, str]) -> Optional[str]: ...
\r
120 class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler):
\r
121 auth_header = ... # type: str
\r
122 handler_order = ... # type: int
\r
123 def http_error_401(self, req, fp, code, msg, headers): ...
\r
125 class ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler):
\r
126 auth_header = ... # type: str
\r
127 handler_order = ... # type: int
\r
128 def http_error_407(self, req, fp, code, msg, headers): ...
\r
130 class AbstractHTTPHandler(BaseHandler):
\r
131 def __init__(self, debuglevel: int = ...) -> None: ...
\r
132 def do_request_(self, request): ...
\r
133 def do_open(self, http_class, req): ...
\r
135 class HTTPHandler(AbstractHTTPHandler):
\r
136 def http_open(self, req): ...
\r
137 def http_request(self, request): ...
\r
139 class HTTPSHandler(AbstractHTTPHandler):
\r
140 def __init__(self, debuglevel=0, context=None): ...
\r
141 def https_open(self, req): ...
\r
142 def https_request(self, request): ...
\r
144 class HTTPCookieProcessor(BaseHandler):
\r
145 def __init__(self, cookiejar=None): ...
\r
146 def http_request(self, request): ...
\r
147 def http_response(self, request, response): ...
\r
149 class UnknownHandler(BaseHandler):
\r
150 def unknown_open(self, req): ...
\r
152 class FileHandler(BaseHandler):
\r
153 def file_open(self, req): ...
\r
154 def get_names(self): ...
\r
155 def open_local_file(self, req): ...
\r
157 class FTPHandler(BaseHandler):
\r
158 def ftp_open(self, req): ...
\r
159 def connect_ftp(self, user, passwd, host, port, dirs, timeout): ...
\r
161 class CacheFTPHandler(FTPHandler):
\r
162 def __init__(self) -> None: ...
\r
163 def setTimeout(self, t): ...
\r
164 def setMaxConns(self, m): ...
\r
165 def check_cache(self): ...
\r
166 def clear_cache(self): ...
\r
168 def parse_http_list(s: AnyStr) -> List[AnyStr]: ...
\r
169 def parse_keqv_list(l: List[AnyStr]) -> Dict[AnyStr, AnyStr]: ...
\r