From 490db4316b3012e689b10f187d6c19042373fef4 Mon Sep 17 00:00:00 2001 From: Botond Hende Date: Mon, 19 Aug 2024 13:46:32 +0200 Subject: first api call --- modules/__init__.py | 0 modules/daemon.py | 17 +++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 modules/__init__.py create mode 100644 modules/daemon.py (limited to 'modules') diff --git a/modules/__init__.py b/modules/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/modules/daemon.py b/modules/daemon.py new file mode 100644 index 0000000..e5987d2 --- /dev/null +++ b/modules/daemon.py @@ -0,0 +1,17 @@ +import openapi_client + +class Daemon(): + + def __init__(self, agent_symbol, token): + config = openapi_client.Configuration(access_token = token) + self.api_client = openapi_client.ApiClient(config) + self.api_instance = openapi_client.AgentsApi(self.api_client) + self.agent_symbol = agent_symbol + + def run(self): + try: + api_response = self.api_instance.get_agent(self.agent_symbol) + print("The response of AgentsApi->get_agent:\n") + print(api_response) + except Exception as e: + print("Exception when calling AgentsApi->get_agent: %s\n" % e) -- cgit v1.2.3-70-g09d2