2 from _typeshed.wsgi import WSGIEnvironment
3 from typing import Any, Generic, Text, Type, TypeVar, overload
4 from typing_extensions import Literal
6 if sys.version_info >= (3, 0):
7 from http.cookiejar import CookieJar
8 from urllib.request import Request as U2Request
10 from cookielib import CookieJar
11 from urllib2 import Request as U2Request
13 def stream_encode_multipart(values, use_tempfile: int = ..., threshold=..., boundary: Any | None = ..., charset: Text = ...): ...
14 def encode_multipart(values, boundary: Any | None = ..., charset: Text = ...): ...
15 def File(fd, filename: Any | None = ..., mimetype: Any | None = ...): ...
17 class _TestCookieHeaders:
19 def __init__(self, headers): ...
20 def getheaders(self, name): ...
21 def get_all(self, name, default: Any | None = ...): ...
23 class _TestCookieResponse:
25 def __init__(self, headers): ...
28 class _TestCookieJar(CookieJar):
29 def inject_wsgi(self, environ): ...
30 def extract_wsgi(self, environ, headers): ...
49 environ_overrides: Any
56 base_url: Any | None = ...,
57 query_string: Any | None = ...,
59 input_stream: Any | None = ...,
60 content_type: Any | None = ...,
61 content_length: Any | None = ...,
62 errors_stream: Any | None = ...,
63 multithread: bool = ...,
64 multiprocess: bool = ...,
66 headers: Any | None = ...,
67 data: Any | None = ...,
68 environ_base: Any | None = ...,
69 environ_overrides: Any | None = ...,
75 def server_name(self) -> str: ...
77 def server_port(self) -> int: ...
78 def __del__(self) -> None: ...
79 def close(self) -> None: ...
80 def get_environ(self) -> WSGIEnvironment: ...
81 def get_request(self, cls: Any | None = ...): ...
83 class ClientRedirectError(Exception): ...
85 # Response type for the client below.
86 # By default _R is Tuple[Iterable[Any], Text | int, datastructures.Headers]
89 class Client(Generic[_R]):
91 response_wrapper: Type[_R] | None
93 allow_subdomain_redirects: Any
95 self, application, response_wrapper: Type[_R] | None = ..., use_cookies: bool = ..., allow_subdomain_redirects: bool = ...
102 max_age: Any | None = ...,
103 expires: Any | None = ...,
105 domain: Any | None = ...,
106 secure: Any | None = ...,
107 httponly: bool = ...,
110 def delete_cookie(self, server_name, key, path: str = ..., domain: Any | None = ...): ...
111 def run_wsgi_app(self, environ, buffered: bool = ...): ...
112 def resolve_redirect(self, response, new_location, environ, buffered: bool = ...): ...
114 def open(self, *args, as_tuple: Literal[True], **kwargs) -> tuple[WSGIEnvironment, _R]: ...
116 def open(self, *args, as_tuple: Literal[False] = ..., **kwargs) -> _R: ...
118 def open(self, *args, as_tuple: bool, **kwargs) -> Any: ...
120 def get(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
122 def get(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
124 def get(self, *args, as_tuple: bool, **kw) -> Any: ...
126 def patch(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
128 def patch(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
130 def patch(self, *args, as_tuple: bool, **kw) -> Any: ...
132 def post(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
134 def post(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
136 def post(self, *args, as_tuple: bool, **kw) -> Any: ...
138 def head(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
140 def head(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
142 def head(self, *args, as_tuple: bool, **kw) -> Any: ...
144 def put(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
146 def put(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
148 def put(self, *args, as_tuple: bool, **kw) -> Any: ...
150 def delete(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
152 def delete(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
154 def delete(self, *args, as_tuple: bool, **kw) -> Any: ...
156 def options(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
158 def options(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
160 def options(self, *args, as_tuple: bool, **kw) -> Any: ...
162 def trace(self, *args, as_tuple: Literal[True], **kw) -> tuple[WSGIEnvironment, _R]: ...
164 def trace(self, *args, as_tuple: Literal[False] = ..., **kw) -> _R: ...
166 def trace(self, *args, as_tuple: bool, **kw) -> Any: ...
168 def create_environ(*args, **kwargs): ...
169 def run_wsgi_app(app, environ, buffered: bool = ...): ...