Skip to content

Commit dbf139c

Browse files
committed
Allow event API params to be overridden
1 parent ec5806d commit dbf139c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

legistar/events.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def _init_webscraper(self):
196196

197197
return webscraper
198198

199-
def api_events(self, since_datetime=None):
199+
def api_events(self, since_datetime=None, override_params=None):
200200
# scrape from oldest to newest. This makes resuming big
201201
# scraping jobs easier because upon a scrape failure we can
202202
# import everything scraped and then scrape everything newer
@@ -226,6 +226,8 @@ def api_events(self, since_datetime=None):
226226
for field in update_fields)
227227

228228
params['$filter'] = since_filter
229+
230+
params.update(override_params or {})
229231

230232
events_url = self.BASE_URL + '/events/'
231233

@@ -413,8 +415,8 @@ class WebCalendarMixin:
413415
"""
414416
Sometimes, it's desirable to retrieve information from the web calendar,
415417
in addition to the API. This mixin extends the base functionality to get
416-
event information from both the detail page, if accessible, and the web
417-
calendar listing.
418+
event information from both the detail page linked to in the API and the
419+
web calendar listing.
418420
"""
419421
def __init__(self, *args, **kwargs):
420422
super().__init__(*args, **kwargs)
@@ -430,14 +432,12 @@ def __init__(self, *args, **kwargs):
430432

431433
def _get_web_event(self, api_event):
432434
if self._not_in_web_interface(api_event):
433-
event_detail = {}
434-
else:
435-
# None if detail link does not exist or cannot be found.
436-
event_detail = super()._get_web_event(api_event) or {}
435+
return None
436+
437+
# None if detail link does not exist or cannot be found.
438+
event_detail = super()._get_web_event(api_event) or {}
437439

438-
# Sometimes events can appear on the calendar before their detail links
439-
# become available. None if entire web calendar scraped but event not
440-
# found.
440+
# None if entire web calendar scraped but event not found.
441441
event_listing = self.web_results(api_event) or {}
442442

443443
return (event_listing | event_detail) or None

0 commit comments

Comments
 (0)