From 36c4fc3c7af1a5cf5b160608dd8b77121d94c6e9 Mon Sep 17 00:00:00 2001 From: braykuka Date: Tue, 13 Aug 2024 20:15:48 +0200 Subject: [PATCH] WA: Tweak EmptyScrape Exception on Events --- scrapers/wa/events.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scrapers/wa/events.py b/scrapers/wa/events.py index cba5567846..06e2b0cc9e 100644 --- a/scrapers/wa/events.py +++ b/scrapers/wa/events.py @@ -39,8 +39,14 @@ def scrape(self, chamber=None, session=None, start=None, end=None): end = datetime.datetime.strptime(end, "%Y-%m-%d").strftime(print_format) chambers = [chamber] if chamber else ["upper", "lower", "joint"] + + event_count = 0 for chamber in chambers: - yield from self.scrape_chamber(chamber, session, start, end) + for event in self.scrape_chamber(chamber, session, start, end): + event_count += 1 + yield event + if event_count < 1: + raise EmptyScrape # Only need to fetch the XML once for both chambers def get_xml(self, start, end):