Skip to content

Commit

Permalink
Support minimal config for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nihalsid committed May 25, 2020
1 parent 786bbc9 commit 4155536
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions flathunter/hunter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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:
Expand Down

0 comments on commit 4155536

Please sign in to comment.