MCPcopy
hub / github.com/aio-libs/aiohttp / _request

Method _request

aiohttp/client.py:537–1025  ·  view source on GitHub ↗
(
        self,
        method: str,
        str_or_url: StrOrURL,
        *,
        params: Query = None,
        data: Any = None,
        json: Any = None,
        cookies: LooseCookies | None = None,
        headers: LooseHeaders | None = None,
        skip_auto_headers: Iterable[str] | None = None,
        auth: BasicAuth | None = None,
        allow_redirects: bool = True,
        max_redirects: int = 10,
        compress: str | bool | None = None,
        chunked: bool | None = None,
        expect100: bool = False,
        raise_for_status: (
            None | bool | Callable[[ClientResponse], Awaitable[None]]
        ) = None,
        read_until_eof: bool = True,
        proxy: StrOrURL | None = None,
        proxy_auth: BasicAuth | None = None,
        timeout: ClientTimeout | _SENTINEL = sentinel,
        verify_ssl: bool | None = None,
        fingerprint: bytes | None = None,
        ssl_context: SSLContext | None = None,
        ssl: SSLContext | bool | Fingerprint = True,
        server_hostname: str | None = None,
        proxy_headers: LooseHeaders | None = None,
        trace_request_ctx: object = None,
        read_bufsize: int | None = None,
        auto_decompress: bool | None = None,
        max_line_size: int | None = None,
        max_field_size: int | None = None,
        max_headers: int | None = None,
        middlewares: Sequence[ClientMiddlewareType] | None = None,
    )

Source from the content-addressed store, hash-verified

535 return url
536
537 async def _request(
538 self,
539 method: str,
540 str_or_url: StrOrURL,
541 *,
542 params: Query = None,
543 data: Any = None,
544 json: Any = None,
545 cookies: LooseCookies | None = None,
546 headers: LooseHeaders | None = None,
547 skip_auto_headers: Iterable[str] | None = None,
548 auth: BasicAuth | None = None,
549 allow_redirects: bool = True,
550 max_redirects: int = 10,
551 compress: str | bool | None = None,
552 chunked: bool | None = None,
553 expect100: bool = False,
554 raise_for_status: (
555 None | bool | Callable[[ClientResponse], Awaitable[None]]
556 ) = None,
557 read_until_eof: bool = True,
558 proxy: StrOrURL | None = None,
559 proxy_auth: BasicAuth | None = None,
560 timeout: ClientTimeout | _SENTINEL = sentinel,
561 verify_ssl: bool | None = None,
562 fingerprint: bytes | None = None,
563 ssl_context: SSLContext | None = None,
564 ssl: SSLContext | bool | Fingerprint = True,
565 server_hostname: str | None = None,
566 proxy_headers: LooseHeaders | None = None,
567 trace_request_ctx: object = None,
568 read_bufsize: int | None = None,
569 auto_decompress: bool | None = None,
570 max_line_size: int | None = None,
571 max_field_size: int | None = None,
572 max_headers: int | None = None,
573 middlewares: Sequence[ClientMiddlewareType] | None = None,
574 ) -> ClientResponse:
575
576 # NOTE: timeout clamps existing connect and read timeouts. We cannot
577 # set the default to None because we need to detect if the user wants
578 # to use the existing timeouts by setting timeout to None.
579
580 if self.closed:
581 raise RuntimeError("Session is closed")
582
583 ssl = _merge_ssl_params(ssl, verify_ssl, ssl_context, fingerprint)
584
585 if auth is not None:
586 warnings.warn(
587 "The 'auth' parameter is deprecated and will be removed in v4;"
588 " pass headers={'Authorization': "
589 "aiohttp.encode_basic_auth(login, password)} instead",
590 DeprecationWarning,
591 stacklevel=3,
592 )
593 if proxy_auth is not None:
594 warnings.warn(

Callers 9

requestMethod · 0.95
getMethod · 0.95
optionsMethod · 0.95
headMethod · 0.95
postMethod · 0.95
putMethod · 0.95
patchMethod · 0.95
deleteMethod · 0.95
requestFunction · 0.95

Calls 15

_prepare_headersMethod · 0.95
_build_urlMethod · 0.95
startMethod · 0.95
timerMethod · 0.95
filter_cookiesMethod · 0.95
update_cookiesMethod · 0.95
closeMethod · 0.95
_merge_ssl_paramsFunction · 0.85
InvalidURLClass · 0.85
ClientTimeoutClass · 0.85

Tested by

no test coverage detected