From 9aad7e1910d787e26d601d3fe6b7f9fecf0cf2ff Mon Sep 17 00:00:00 2001 From: Dmitry Date: Sat, 7 Mar 2020 16:14:47 +0300 Subject: [PATCH] make service even when config is None --- sync_ics2gcal/gcal.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sync_ics2gcal/gcal.py b/sync_ics2gcal/gcal.py index c6e817f..fd086ca 100644 --- a/sync_ics2gcal/gcal.py +++ b/sync_ics2gcal/gcal.py @@ -44,20 +44,21 @@ class GoogleCalendarService(): return service @staticmethod - def from_config(config): + def from_config(config=None): """make service Resource from config dict Arguments: config -- dict() config with keys: (optional) service_account: - service account filename if key not in dict then default credentials will be used - ( https://developers.google.com/identity/protocols/application-default-credentials ) + ( https://developers.google.com/identity/protocols/application-default-credentials ) + -- None: default credentials will be used Returns: service Resource """ - if 'service_account' in config: + if (not config is None) and 'service_account' in config: service = GoogleCalendarService.from_srv_acc_file(config['service_account']) else: service = GoogleCalendarService.default()