From f3284da4def08ef5aa50bab8926d3f550d7d8224 Mon Sep 17 00:00:00 2001 From: Andreas Hubel <andi@saerdnaer.de> Date: Sun, 15 Dec 2024 17:59:33 +0100 Subject: [PATCH] chore(schedulejson): use auth config simular to schedulejsonfrab source --- src/core/schedules/schedulejson.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/schedules/schedulejson.py b/src/core/schedules/schedulejson.py index 1d757d61d..63063eae8 100644 --- a/src/core/schedules/schedulejson.py +++ b/src/core/schedules/schedulejson.py @@ -19,8 +19,9 @@ class ScheduleJSONSupport(BaseScheduleSupport): configuration_fields = { # 'key': (type, default value, mandatory, translation text) 'feedback': ('bool', True, False, 'Enable/Disable feedback url generation'), - 'kind': ('string', 'assembly', False, 'kind of events, either "assembly" or "official" or "sos" or "lightning"'), + 'kind': ('string', 'assembly', False, 'kind of events, either `assembly` or `official` or `sos` or `lightning`'), 'headers': ('dict', {}, False, 'HTTP headers to send with the request e.g. Authorization'), + 'auth': ('string', None, False, 'HTTP Authentification header e.g. `Token 123456`'), } # fmt: on @@ -45,6 +46,8 @@ class ScheduleJSONSupport(BaseScheduleSupport): headers = {} if self.conf_value('headers'): headers = self.conf_value('headers') + if self.conf_value('auth'): + headers['Authorization'] = self.conf_value('auth') schedule = ScheduleJSON.from_url(self.remote_url, headers={**headers, 'Accept-Language': 'en'}) schedule_de = ScheduleJSON.from_url(self.remote_url, headers={**headers, 'Accept-Language': 'de'}, event_map=True) -- GitLab