(
self,
path: str = "/",
base_url: str | None = None,
query_string: t.Mapping[str, str] | str | None = None,
method: str = "GET",
input_stream: t.IO[bytes] | None = None,
content_type: str | None = None,
content_length: int | None = None,
errors_stream: t.IO[str] | None = None,
multithread: bool = False,
multiprocess: bool = False,
run_once: bool = False,
headers: Headers | t.Iterable[tuple[str, str]] | None = None,
data: None | (t.IO[bytes] | str | bytes | t.Mapping[str, t.Any]) = None,
environ_base: t.Mapping[str, t.Any] | None = None,
environ_overrides: t.Mapping[str, t.Any] | None = None,
mimetype: str | None = None,
json: t.Mapping[str, t.Any] | None = None,
auth: Authorization | tuple[str, str] | None = None,
)
| 296 | _files: FileMultiDict | None |
| 297 | |
| 298 | def __init__( |
| 299 | self, |
| 300 | path: str = "/", |
| 301 | base_url: str | None = None, |
| 302 | query_string: t.Mapping[str, str] | str | None = None, |
| 303 | method: str = "GET", |
| 304 | input_stream: t.IO[bytes] | None = None, |
| 305 | content_type: str | None = None, |
| 306 | content_length: int | None = None, |
| 307 | errors_stream: t.IO[str] | None = None, |
| 308 | multithread: bool = False, |
| 309 | multiprocess: bool = False, |
| 310 | run_once: bool = False, |
| 311 | headers: Headers | t.Iterable[tuple[str, str]] | None = None, |
| 312 | data: None | (t.IO[bytes] | str | bytes | t.Mapping[str, t.Any]) = None, |
| 313 | environ_base: t.Mapping[str, t.Any] | None = None, |
| 314 | environ_overrides: t.Mapping[str, t.Any] | None = None, |
| 315 | mimetype: str | None = None, |
| 316 | json: t.Mapping[str, t.Any] | None = None, |
| 317 | auth: Authorization | tuple[str, str] | None = None, |
| 318 | ) -> None: |
| 319 | if query_string is not None and "?" in path: |
| 320 | raise ValueError("Query string is defined in the path and as an argument") |
| 321 | request_uri = urlsplit(path) |
| 322 | if query_string is None and "?" in path: |
| 323 | query_string = request_uri.query |
| 324 | |
| 325 | self.path = iri_to_uri(request_uri.path) |
| 326 | self.request_uri = path |
| 327 | if base_url is not None: |
| 328 | base_url = iri_to_uri(base_url) |
| 329 | self.base_url = base_url |
| 330 | if isinstance(query_string, str): |
| 331 | self.query_string = query_string |
| 332 | else: |
| 333 | if query_string is None: |
| 334 | query_string = MultiDict() |
| 335 | elif not isinstance(query_string, MultiDict): |
| 336 | query_string = MultiDict(query_string) |
| 337 | self.args = query_string |
| 338 | self.method = method |
| 339 | if headers is None: |
| 340 | headers = Headers() |
| 341 | elif not isinstance(headers, Headers): |
| 342 | headers = Headers(headers) |
| 343 | self.headers = headers |
| 344 | if content_type is not None: |
| 345 | self.content_type = content_type |
| 346 | if errors_stream is None: |
| 347 | errors_stream = sys.stderr |
| 348 | self.errors_stream = errors_stream |
| 349 | self.multithread = multithread |
| 350 | self.multiprocess = multiprocess |
| 351 | self.run_once = run_once |
| 352 | self.environ_base = environ_base |
| 353 | self.environ_overrides = environ_overrides |
| 354 | self.input_stream = input_stream |
| 355 | self.content_length = content_length |
nothing calls this directly
no test coverage detected