From 6ec24157f27b653d7d0968b9bb9f5aecaf23530f Mon Sep 17 00:00:00 2001 From: Athanasius Date: Fri, 16 Oct 2020 15:36:48 +0100 Subject: [PATCH] CAPIData: Only call self.check_modules_ships() if lastStarport present * The companion Session.query is called for *all* CAPI endpoints and only the /profile one will return lastStartport data, which is where ships/modules are if present, so only do these checks if we see lastStarport. --- companion.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/companion.py b/companion.py index d1a35c6d..7d6bbe36 100644 --- a/companion.py +++ b/companion.py @@ -137,7 +137,9 @@ class CAPIData(UserDict): self.original_data = self.data.copy() # Just in case - self.check_modules_ships() + # Only the /profile end point has star port, and thus ships/modules. + if self.data.get('lastStarport'): + self.check_modules_ships() def check_modules_ships(self) -> None: modules: Dict[str, Any] = self.data['lastStarport'].get('modules')