1+ import email .message
12import http .client
3+ import re
4+ from _ssl import _PasswordType
5+ from _typeshed import Incomplete , MaybeNone , StrOrBytesPath
26from collections .abc import Generator
3- from typing import Any , ClassVar
7+ from ssl import _SSLMethod
8+ from typing import ClassVar , Final , Literal , TypeVar
49from typing_extensions import Self
510
611from .error import *
712
8- __author__ : str
9- __copyright__ : str
10- __contributors__ : list [str ]
11- __license__ : str
12- __version__ : str
13+ _T = TypeVar ("_T" , default = str )
1314
14- debuglevel : int
15- RETRIES : int
15+ __author__ : Final [str ]
16+ __copyright__ : Final [str ]
17+ __contributors__ : Final [list [str ]]
18+ __license__ : Final [str ]
19+ __version__ : Final [str ]
20+
21+ def has_timeout (timeout : float | None ) -> bool : ...
22+
23+ debuglevel : Final [int ]
24+ RETRIES : Final [int ]
25+ DEFAULT_MAX_REDIRECTS : Final [int ]
26+ HOP_BY_HOP : Final [list [str ]]
27+ SAFE_METHODS : Final [tuple [str , ...]]
28+ REDIRECT_CODES : Final [frozenset [int ]]
29+ CA_CERTS : Final [str ]
30+ DEFAULT_TLS_VERSION : Final [_SSLMethod ]
31+ URI : Final [re .Pattern [str ]]
32+
33+ def parse_uri (uri : str ) -> tuple [str | MaybeNone , str | MaybeNone , str | MaybeNone , str | MaybeNone , str | MaybeNone ]: ...
34+ def urlnorm (uri : str ) -> tuple [str | MaybeNone , str | MaybeNone , str | MaybeNone , str | MaybeNone ]: ...
35+
36+ re_url_scheme : Final [re .Pattern [str ]]
37+ re_unsafe : Final [re .Pattern [str ]]
38+
39+ def safename (filename : str | bytes ) -> str : ...
40+
41+ NORMALIZE_SPACE : Final [re .Pattern [str ]]
42+ USE_WWW_AUTH_STRICT_PARSING : Final [int ]
1643
1744class Authentication :
18- path : Any
19- host : Any
20- credentials : Any
21- http : Any
22- def __init__ (self , credentials , host , request_uri , headers , response , content , http ) -> None : ...
23- def depth (self , request_uri ) : ...
24- def inscope (self , host , request_uri ) : ...
45+ path : Incomplete
46+ host : Incomplete
47+ credentials : Incomplete
48+ http : Incomplete
49+ def __init__ (self , credentials , host , request_uri : str , headers , response , content , http ) -> None : ...
50+ def depth (self , request_uri : str ) -> int : ...
51+ def inscope (self , host : str , request_uri : str ) -> bool : ...
2552 def request (self , method , request_uri , headers , content ) -> None : ...
26- def response (self , response , content ): ...
27- def __eq__ (self , auth ) : ...
28- def __ne__ (self , auth ) : ...
29- def __lt__ (self , auth ) : ...
30- def __gt__ (self , auth ) : ...
31- def __le__ (self , auth ) : ...
32- def __ge__ (self , auth ) : ...
53+ def response (self , response , content ) -> bool : ...
54+ def __eq__ (self , auth : object ) -> bool : ...
55+ def __ne__ (self , auth : object ) -> bool : ...
56+ def __lt__ (self , auth : object ) -> bool : ...
57+ def __gt__ (self , auth : object ) -> bool : ...
58+ def __le__ (self , auth : object ) -> bool : ...
59+ def __ge__ (self , auth : object ) -> bool : ...
3360 def __bool__ (self ) -> bool : ...
3461
3562class BasicAuthentication (Authentication ):
3663 def __init__ (self , credentials , host , request_uri , headers , response , content , http ) -> None : ...
3764 def request (self , method , request_uri , headers , content ) -> None : ...
3865
3966class DigestAuthentication (Authentication ):
40- challenge : Any
41- A1 : Any
67+ challenge : Incomplete
68+ A1 : Incomplete
4269 def __init__ (self , credentials , host , request_uri , headers , response , content , http ) -> None : ...
4370 def request (self , method , request_uri , headers , content , cnonce = None ): ...
44- def response (self , response , content ): ...
71+ def response (self , response , content ) -> bool : ...
4572
4673class HmacDigestAuthentication (Authentication ):
47- challenge : Any
48- hashmod : Any
49- pwhashmod : Any
50- key : Any
74+ challenge : Incomplete
75+ hashmod : Incomplete
76+ pwhashmod : Incomplete
77+ key : Incomplete
5178 __author__ : ClassVar [str ]
5279 def __init__ (self , credentials , host , request_uri , headers , response , content , http ) -> None : ...
5380 def request (self , method , request_uri , headers , content ) -> None : ...
54- def response (self , response , content ): ...
81+ def response (self , response , content ) -> bool : ...
5582
5683class WsseAuthentication (Authentication ):
5784 def __init__ (self , credentials , host , request_uri , headers , response , content , http ) -> None : ...
@@ -63,15 +90,15 @@ class GoogleLoginAuthentication(Authentication):
6390 def request (self , method , request_uri , headers , content ) -> None : ...
6491
6592class FileCache :
66- cache : Any
67- safe : Any
93+ cache : Incomplete
94+ safe : Incomplete
6895 def __init__ (self , cache , safe = ...) -> None : ...
6996 def get (self , key ): ...
7097 def set (self , key , value ) -> None : ...
7198 def delete (self , key ) -> None : ...
7299
73100class Credentials :
74- credentials : Any
101+ credentials : Incomplete
75102 def __init__ (self ) -> None : ...
76103 def add (self , name , password , domain : str = "" ) -> None : ...
77104 def clear (self ) -> None : ...
@@ -84,7 +111,7 @@ class KeyCerts(Credentials):
84111class AllHosts : ...
85112
86113class ProxyInfo :
87- bypass_hosts : Any
114+ bypass_hosts : Incomplete
88115 def __init__ (
89116 self , proxy_type , proxy_host , proxy_port , proxy_rdns : bool = True , proxy_user = None , proxy_pass = None , proxy_headers = None
90117 ) -> None : ...
@@ -93,60 +120,65 @@ class ProxyInfo:
93120 def applies_to (self , hostname ): ...
94121 def bypass_host (self , hostname ): ...
95122
123+ def proxy_info_from_environment (method : Literal ["http" , "https" ] = "http" ) -> ProxyInfo | None : ...
124+ def proxy_info_from_url (url : str , method : Literal ["http" , "https" ] = "http" , noproxy : str | None = None ) -> ProxyInfo : ...
125+
96126class HTTPConnectionWithTimeout (http .client .HTTPConnection ):
97- proxy_info : Any
127+ proxy_info : Incomplete
98128 def __init__ (self , host , port = None , timeout = None , proxy_info = None ) -> None : ...
99- sock : Any
129+ sock : Incomplete
100130 def connect (self ) -> None : ...
101131
102132class HTTPSConnectionWithTimeout (http .client .HTTPSConnection ):
103- disable_ssl_certificate_validation : Any
104- ca_certs : Any
105- proxy_info : Any
106- key_file : Any
107- cert_file : Any
108- key_password : Any
133+ disable_ssl_certificate_validation : bool
134+ ca_certs : StrOrBytesPath | None
135+ proxy_info : Incomplete
136+ key_file : StrOrBytesPath | None
137+ cert_file : StrOrBytesPath | None
138+ key_password : _PasswordType | None
109139 def __init__ (
110140 self ,
111- host ,
112- port = None ,
113- key_file = None ,
114- cert_file = None ,
115- timeout = None ,
141+ host : str ,
142+ port : int | None = None ,
143+ key_file : StrOrBytesPath | None = None ,
144+ cert_file : StrOrBytesPath | None = None ,
145+ timeout : float | None = None ,
116146 proxy_info = None ,
117- ca_certs = None ,
147+ ca_certs : StrOrBytesPath | None = None ,
118148 disable_ssl_certificate_validation : bool = False ,
119149 tls_maximum_version = None ,
120150 tls_minimum_version = None ,
121- key_password = None ,
151+ key_password : _PasswordType | None = None ,
122152 ) -> None : ...
123- sock : Any
153+ sock : Incomplete
124154 def connect (self ) -> None : ...
125155
156+ SCHEME_TO_CONNECTION : Final [dict [Literal ["http" , "https" ], type [http .client .HTTPConnection ]]]
157+
126158class Http :
127- proxy_info : Any
128- ca_certs : Any
129- disable_ssl_certificate_validation : Any
130- tls_maximum_version : Any
131- tls_minimum_version : Any
132- connections : Any
133- cache : Any
134- credentials : Any
135- certificates : Any
136- authorizations : Any
159+ proxy_info : Incomplete
160+ ca_certs : Incomplete
161+ disable_ssl_certificate_validation : bool
162+ tls_maximum_version : Incomplete
163+ tls_minimum_version : Incomplete
164+ connections : Incomplete
165+ cache : FileCache
166+ credentials : Credentials
167+ certificates : KeyCerts
168+ authorizations : list [ Authentication ]
137169 follow_redirects : bool
138- redirect_codes : Any
139- optimistic_concurrency_methods : Any
140- safe_methods : Any
170+ redirect_codes : frozenset [ int ]
171+ optimistic_concurrency_methods : list [ str ]
172+ safe_methods : list [ str ]
141173 follow_all_redirects : bool
142174 ignore_etag : bool
143175 force_exception_to_status_code : bool
144- timeout : Any
176+ timeout : float | None
145177 forward_authorization_headers : bool
146178 def __init__ (
147179 self ,
148- cache = None ,
149- timeout = None ,
180+ cache : str | FileCache | None = None ,
181+ timeout : float | None = None ,
150182 proxy_info = ...,
151183 ca_certs = None ,
152184 disable_ssl_certificate_validation : bool = False ,
@@ -159,13 +191,13 @@ class Http:
159191 def clear_credentials (self ) -> None : ...
160192 def request (self , uri , method : str = "GET" , body = None , headers = None , redirections = 5 , connection_type = None ): ...
161193
162- class Response (dict [str , Any ]):
194+ class Response (dict [str , str | _T ]):
163195 fromcache : bool
164196 version : int
165197 status : int
166198 reason : str
167- previous : Any
168- def __init__ (self , info ) -> None : ...
199+ previous : Response [ _T ] | None
200+ def __init__ (self , info : http . client . HTTPResponse | email . message . Message | dict [ str , _T ] ) -> None : ...
169201 @property
170202 def dict (self ) -> Self : ...
171203
0 commit comments