From 1638f40eccc4a1321ee1bf19e3756157b6c965e1 Mon Sep 17 00:00:00 2001 From: Botond Hende Date: Mon, 2 Sep 2024 00:21:13 +0200 Subject: refactored code, use get_ship dependency for ship related calls --- modules/daemon.py | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 modules/daemon.py (limited to 'modules/daemon.py') diff --git a/modules/daemon.py b/modules/daemon.py deleted file mode 100644 index 085a7f6..0000000 --- a/modules/daemon.py +++ /dev/null @@ -1,36 +0,0 @@ -import openapi_client -from fastapi import FastAPI -from pprint import pprint - -fast_api = FastAPI() - -class Daemon: - def __init__(self, agent_symbol, token): - config = openapi_client.Configuration(access_token=token) - self.api_client = openapi_client.ApiClient(config) - - 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 - - @fast_api.get("/") - def foo(self): - return "hello" - - def run(self): - try: - 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) -- cgit v1.2.3-70-g09d2