summaryrefslogtreecommitdiff
path: root/modules/daemon.py
diff options
context:
space:
mode:
authorBotond Hende <nettingman@gmail.com>2024-08-20 01:23:35 +0200
committerBotond Hende <nettingman@gmail.com>2024-08-20 01:23:35 +0200
commitb0bdd79ba340e879f3f79b9dd04f7509f8c681d5 (patch)
treeb5a568a7c8d0e1b162f5c7d8930b2539dc2d8d57 /modules/daemon.py
parent490db4316b3012e689b10f187d6c19042373fef4 (diff)
api call examples
Diffstat (limited to 'modules/daemon.py')
-rw-r--r--modules/daemon.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/modules/daemon.py b/modules/daemon.py
index e5987d2..a78e70b 100644
--- a/modules/daemon.py
+++ b/modules/daemon.py
@@ -1,17 +1,30 @@
import openapi_client
+from pprint import pprint
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.agents_api = openapi_client.AgentsApi(self.api_client)
+ self.fleet_api = openapi_client.FleetApi(self.api_client)
+ self.systems_api = openapi_client.SystemsApi(self.api_client)
+
self.agent_symbol = agent_symbol
def run(self):
try:
- api_response = self.api_instance.get_agent(self.agent_symbol)
+ api_response = self.agents_api.get_agent(self.agent_symbol)
print("The response of AgentsApi->get_agent:\n")
print(api_response)
+
+ api_response = self.fleet_api.get_my_ships()
+ for elem in api_response.data:
+ print(elem.symbol, elem.nav.waypoint_symbol, elem.nav.status)
+ waypoint = self.systems_api.get_waypoint(elem.nav.system_symbol, elem.nav.waypoint_symbol).data
+
+ print(waypoint.symbol, waypoint.type)
+
except Exception as e:
print("Exception when calling AgentsApi->get_agent: %s\n" % e)