AlipayIserviceCognitiveOcrTablesQueryResponse.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.response.AlipayResponse import AlipayResponse
  5. from alipay.aop.api.domain.AiOcrTableRow import AiOcrTableRow
  6. class AlipayIserviceCognitiveOcrTablesQueryResponse(AlipayResponse):
  7. def __init__(self):
  8. super(AlipayIserviceCognitiveOcrTablesQueryResponse, self).__init__()
  9. self._success = None
  10. self._tables = None
  11. self._trace_id = None
  12. @property
  13. def success(self):
  14. return self._success
  15. @success.setter
  16. def success(self, value):
  17. self._success = value
  18. @property
  19. def tables(self):
  20. return self._tables
  21. @tables.setter
  22. def tables(self, value):
  23. if isinstance(value, list):
  24. self._tables = list()
  25. for i in value:
  26. if isinstance(i, AiOcrTableRow):
  27. self._tables.append(i)
  28. else:
  29. self._tables.append(AiOcrTableRow.from_alipay_dict(i))
  30. @property
  31. def trace_id(self):
  32. return self._trace_id
  33. @trace_id.setter
  34. def trace_id(self, value):
  35. self._trace_id = value
  36. def parse_response_content(self, response_content):
  37. response = super(AlipayIserviceCognitiveOcrTablesQueryResponse, self).parse_response_content(response_content)
  38. if 'success' in response:
  39. self.success = response['success']
  40. if 'tables' in response:
  41. self.tables = response['tables']
  42. if 'trace_id' in response:
  43. self.trace_id = response['trace_id']