MCPcopy Create free account
hub / github.com/dwavesystems/dwave-cloud-client / request

Method request

dwave/cloud/api/client.py:339–357  ·  view source on GitHub ↗
(self, *args, headers: Optional[dict] = None, **kwargs)

Source from the content-addressed store, hash-verified

337 'Try upgrading "dwave-cloud-client".')
338
339 def request(self, *args, headers: Optional[dict] = None, **kwargs) -> requests.Response:
340 # (1) communicate lower bound on version handled in the outgoing request
341 # (via media type in `Accept` header field)
342 if self._media_type is not None:
343 params = {} if self._media_type_params is None else self._media_type_params.copy()
344 if self._ask_version:
345 params['version'] = self._ask_version
346
347 headers = {} if headers is None else headers.copy()
348 headers['Accept'] = werkzeug.http.dump_options_header(self._media_type, params)
349
350 response = super().request(*args, headers=headers, **kwargs)
351
352 # (2) validate format/version supported in the incoming response
353 # (validate `Content-Type` if `media_type` and/or `accept_version` set)
354 if self._media_type is not None:
355 self._validate_response_content_type(response)
356
357 return response
358
359
360class VersionedAPISession(VersionedAPISessionMixin, PayloadCompressingSession):

Callers

nothing calls this directly

Calls 3

copyMethod · 0.80
requestMethod · 0.45

Tested by

no test coverage detected