From 4d6443effcf02aa92f902278997d44e0654f456f Mon Sep 17 00:00:00 2001 From: Salvoxia <Salvoxia@blindfish.info> Date: Sat, 7 Sep 2024 16:03:32 +0200 Subject: [PATCH] Version Check Only assume old version on status code 404, raise communication error for all other codes --- immich_auto_album.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/immich_auto_album.py b/immich_auto_album.py index f404e2b..d079864 100644 --- a/immich_auto_album.py +++ b/immich_auto_album.py @@ -267,8 +267,12 @@ def fetchServerVersion() -> dict: if r.status_code == 200: version = r.json() logging.info("Detected Immich server version %s.%s.%s", version['major'], version['minor'], version['patch']) - else: + # Since the API call did not exist prior to 1.106.1, we assume that 404 means we found an old version. + elif r.status_code == 404: logging.info("Detected Immich server version %s.%s.%s or older", version['major'], version['minor'], version['patch']) + # Any other errors mean communication error with API + else: + r.raise_for_status() return version