MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / deserialize

Method deserialize

sdks/python/src/e2a/v1/generated/api_client.py:400–430  ·  view source on GitHub ↗

Deserializes response into an object. :param response: RESTResponse object to be deserialized. :param response_type: class literal for deserialized object, or string of class name. :param content_type: content type of response. :return: deserialized obje

(self, response_text: str, response_type: str, content_type: Optional[str])

Source from the content-addressed store, hash-verified

398 }
399
400 def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
401 """Deserializes response into an object.
402
403 :param response: RESTResponse object to be deserialized.
404 :param response_type: class literal for
405 deserialized object, or string of class name.
406 :param content_type: content type of response.
407
408 :return: deserialized object.
409 """
410
411 # fetch data from response object
412 if content_type is None:
413 try:
414 data = json.loads(response_text)
415 except ValueError:
416 data = response_text
417 elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
418 if response_text == "":
419 data = ""
420 else:
421 data = json.loads(response_text)
422 elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE):
423 data = response_text
424 else:
425 raise ApiException(
426 status=0,
427 reason="Unsupported content type: {0}".format(content_type)
428 )
429
430 return self.__deserialize(data, response_type)
431
432 def __deserialize(self, data, klass):
433 """Deserializes dict, list, str into an object.

Callers 1

response_deserializeMethod · 0.95

Calls 2

__deserializeMethod · 0.95
ApiExceptionClass · 0.90

Tested by

no test coverage detected