22
33from collections .abc import Callable , Iterable , Iterator
44from types import TracebackType
5- from typing import Any , Protocol , TypeAlias
5+ from typing import Any , Literal , NotRequired , Protocol , TypeAlias , TypedDict
66
77__all__ = [
88 "StartResponse" ,
@@ -26,7 +26,29 @@ def __call__(
2626 / ,
2727 ) -> Callable [[bytes ], object ]: ...
2828
29- WSGIEnvironment : TypeAlias = dict [str , Any ]
29+ WSGIEnvironment = TypedDict (
30+ "WSGIEnvironment" ,
31+ {
32+ "REQUEST_METHOD" : str ,
33+ "SCRIPT_NAME" : NotRequired [str ],
34+ "PATH_INFO" : NotRequired [str ],
35+ "QUERY_STRING" : NotRequired [str ],
36+ "CONTENT_TYPE" : NotRequired [str ],
37+ "CONTENT_LENGTH" : NotRequired [str ],
38+ "SERVER_NAME" : str ,
39+ "SERVER_PORT" : str ,
40+ "SERVER_PROTOCOL" : str ,
41+ "wsgi.version" : tuple [Literal [1 ], Literal [0 ]],
42+ "wsgi.url_scheme" : str ,
43+ "wsgi.input" : "InputStream" ,
44+ "wsgi.errors" : "ErrorStream" ,
45+ "wsgi.multithread" : Any ,
46+ "wsgi.multiprocess" : Any ,
47+ "wsgi.run_once" : Any ,
48+ "wsgi.file_wrapper" : NotRequired ["FileWrapper" ],
49+ },
50+ extra_items = Any ,
51+ )
3052WSGIApplication : TypeAlias = Callable [[WSGIEnvironment , StartResponse ],
3153 Iterable [bytes ]]
3254
0 commit comments