MCPcopy Create free account
hub / github.com/DeepL/deepl-python / request

Method request

deepl/http_client.py:144–164  ·  view source on GitHub ↗

Makes API request and returns response content. Response is returned as HTTP status code and either content string (if stream is False) or response (if stream is True). If no response is received will raise ConnectionException.

(
        self,
        method: str,
        url: str,
        data: Optional[dict],
        json: Optional[dict],
        headers: dict,
        stream: bool = False,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

142 backoff.sleep_until_deadline()
143
144 def request(
145 self,
146 method: str,
147 url: str,
148 data: Optional[dict],
149 json: Optional[dict],
150 headers: dict,
151 stream: bool = False,
152 **kwargs,
153 ) -> Tuple[int, Union[str, requests.Response]]:
154 """Makes API request and returns response content.
155
156 Response is returned as HTTP status code and either content string (if
157 stream is False) or response (if stream is True).
158
159 If no response is received will raise ConnectionException."""
160
161 request = self._prepare_request(
162 method, url, data, json, headers, **kwargs
163 )
164 return self._internal_request(request, stream)
165
166 def _internal_request(
167 self,

Callers

nothing calls this directly

Calls 2

_prepare_requestMethod · 0.95
_internal_requestMethod · 0.95

Tested by

no test coverage detected