atoti.Client.http_client#
- property Client.http_client: Client#
The httpx.Client to communicate with Atoti Server.
Tip
It is recommended to use this client instead of reimplementing Atoti Server specific concerns like authentication and error handling with another library such as AIOHTTP or requests.
Example
Pinging the server:
>>> path = f"{session.client.get_path_and_version_id('activeviam/pivot')[0]}/ping" >>> path 'activeviam/pivot/rest/v10/ping' >>> session.client.http_client.get(path).raise_for_status().text 'pong'
If the server returns an error as a JSON response containing a stack trace, the raised Python exception’s message will be set to that stack trace:
>>> path = f"{session.client.get_path_and_version_id('activeviam/pivot')[0]}/cube/query/mdx" >>> response = session.client.http_client.post( ... path, json={"mdx": "Some invalid MDX"} ... ) >>> response.raise_for_status() Traceback (most recent call last): ... httpx.HTTPStatusError: com.activeviam.tech.core.api.exceptions.service.BadArgumentException: [400] The provided MDX query is invalid. ... Caused by: ...: Some invalid MDX ... Caused by: ...: Parser failure: ... >>> sorted(response.json().keys()) ['errorChain', 'stackTrace']