From 611696991a4ef2e538a2e2a35ecf8c141bf0afc7 Mon Sep 17 00:00:00 2001 From: anxuae Date: Sun, 1 May 2022 19:46:27 +0200 Subject: [PATCH] Fix client_id_file reading --- pibooth_google_photo.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pibooth_google_photo.py b/pibooth_google_photo.py index 2575637..d735b29 100644 --- a/pibooth_google_photo.py +++ b/pibooth_google_photo.py @@ -19,7 +19,7 @@ from pibooth.utils import LOGGER -__version__ = "1.2.2" +__version__ = "1.2.3" SECTION = 'GOOGLE' CACHE_FILE = '.google_token.json' @@ -132,6 +132,11 @@ def _get_authorized_session(self): credentials = Credentials.from_authorized_user_file(self.token_cache_file, self.SCOPES) with open(self.client_id_file) as fd: data = json.load(fd) + if "web" in data: + data = data["web"] + elif "installed" in data: + data = data["installed"] + if credentials.client_id != data.get('client_id') or\ credentials.client_secret != data.get('client_secret'): LOGGER.debug("Application key or secret has changed, store new token in file '%s'",