mirror of
https://github.com/b4tman/sync_ics2gcal
synced 2025-02-01 20:28:30 +00:00
make service even when config is None
This commit is contained in:
parent
41cc6b4159
commit
9aad7e1910
@ -44,20 +44,21 @@ class GoogleCalendarService():
|
|||||||
return service
|
return service
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_config(config):
|
def from_config(config=None):
|
||||||
"""make service Resource from config dict
|
"""make service Resource from config dict
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
config -- dict() config with keys:
|
config -- dict() config with keys:
|
||||||
(optional) service_account: - service account filename
|
(optional) service_account: - service account filename
|
||||||
if key not in dict then default credentials will be used
|
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:
|
Returns:
|
||||||
service Resource
|
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'])
|
service = GoogleCalendarService.from_srv_acc_file(config['service_account'])
|
||||||
else:
|
else:
|
||||||
service = GoogleCalendarService.default()
|
service = GoogleCalendarService.default()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user