MCPcopy
hub / github.com/psf/requests / request

Method request

src/requests/sessions.py:557–653  ·  view source on GitHub ↗

Constructs a :class:`Request <Request>`, prepares it and sends it. Returns :class:`Response <Response>` object. :param method: method for the new :class:`Request` object. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary or byt

(
        self,
        method: str,
        url: _t.UriType,
        params: _t.ParamsType = None,
        data: _t.DataType = None,
        headers: _t.HeadersType = None,
        cookies: RequestsCookieJar | CookieJar | dict[str, str] | None = None,
        files: _t.FilesType = None,
        auth: _t.AuthType = None,
        timeout: _t.TimeoutType = None,
        allow_redirects: bool = True,
        proxies: dict[str, str] | None = None,
        hooks: _t.HooksInputType | None = None,
        stream: bool | None = None,
        verify: _t.VerifyType | None = None,
        cert: _t.CertType = None,
        json: _t.JsonType = None,
    )

Source from the content-addressed store, hash-verified

555 return p
556
557 def request(
558 self,
559 method: str,
560 url: _t.UriType,
561 params: _t.ParamsType = None,
562 data: _t.DataType = None,
563 headers: _t.HeadersType = None,
564 cookies: RequestsCookieJar | CookieJar | dict[str, str] | None = None,
565 files: _t.FilesType = None,
566 auth: _t.AuthType = None,
567 timeout: _t.TimeoutType = None,
568 allow_redirects: bool = True,
569 proxies: dict[str, str] | None = None,
570 hooks: _t.HooksInputType | None = None,
571 stream: bool | None = None,
572 verify: _t.VerifyType | None = None,
573 cert: _t.CertType = None,
574 json: _t.JsonType = None,
575 ) -> Response:
576 """Constructs a :class:`Request <Request>`, prepares it and sends it.
577 Returns :class:`Response <Response>` object.
578
579 :param method: method for the new :class:`Request` object.
580 :param url: URL for the new :class:`Request` object.
581 :param params: (optional) Dictionary or bytes to be sent in the query
582 string for the :class:`Request`.
583 :param data: (optional) Dictionary, list of tuples, bytes, or file-like
584 object to send in the body of the :class:`Request`.
585 :param json: (optional) json to send in the body of the
586 :class:`Request`.
587 :param headers: (optional) Dictionary of HTTP Headers to send with the
588 :class:`Request`.
589 :param cookies: (optional) Dict or CookieJar object to send with the
590 :class:`Request`.
591 :param files: (optional) Dictionary of ``'filename': file-like-objects``
592 for multipart encoding upload.
593 :param auth: (optional) Auth tuple or callable to enable
594 Basic/Digest/Custom HTTP Auth.
595 :param timeout: (optional) How many seconds to wait for the server to send
596 data before giving up, as a float, or a :ref:`(connect timeout,
597 read timeout) <timeouts>` tuple.
598 :type timeout: float or tuple
599 :param allow_redirects: (optional) Set to True by default.
600 :type allow_redirects: bool
601 :param proxies: (optional) Dictionary mapping protocol or protocol and
602 hostname to the URL of the proxy.
603 :param hooks: (optional) Dictionary mapping hook name to one event or
604 list of events, event must be callable.
605 :param stream: (optional) whether to immediately download the response
606 content. Defaults to ``False``.
607 :param verify: (optional) Either a boolean, in which case it controls whether we verify
608 the server&#x27;s TLS certificate, or a string, in which case it must be a path
609 to a CA bundle to use. Defaults to ``True``. When set to
610 ``False``, requests will accept any TLS certificate presented by
611 the server, and will ignore hostname mismatches and/or expired
612 certificates, which will make your application vulnerable to
613 man-in-the-middle (MitM) attacks. Setting verify to ``False``
614 may be useful during local development or testing.

Callers 13

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

Calls 5

prepare_requestMethod · 0.95
sendMethod · 0.95
RequestClass · 0.85
updateMethod · 0.80