From 41555362f1d37a1f63e21d275061f311c82e4872 Mon Sep 17 00:00:00 2001 From: Yawar Siddiqui Date: Mon, 25 May 2020 23:10:38 +0200 Subject: [PATCH] Support minimal config for tests --- flathunter/hunter.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flathunter/hunter.py b/flathunter/hunter.py index 10484e3b..ced8cb6f 100644 --- a/flathunter/hunter.py +++ b/flathunter/hunter.py @@ -59,7 +59,8 @@ def hunt_flats(self, searchers, id_watch): break # calculate durations if enabled - if self.config["google_maps_api"]["enable"]: + durations_enabled = "google_maps_api" in self.config and self.config["google_maps_api"]["enable"] + if durations_enabled: durations = self.get_formatted_durations(self.config, address).strip() message = self.config.get('message', "").format( @@ -69,7 +70,7 @@ def hunt_flats(self, searchers, id_watch): price=expose['price'], url=expose['url'], address=address, - durations="" if not self.config["google_maps_api"]["enable"] else durations).strip() + durations="" if not durations_enabled else durations).strip() # if no excludes, send messages if len(self.excluded_titles) == 0: