fix: catch JSONDecodeError in API calls, use get_headers() consistently

- get_people() and fetch_all_assets() only caught RequestException, leaving
  JSONDecodeError unhandled if Immich returns a non-JSON 200 response
- cli.py thumbnail fetch used a raw header dict instead of get_headers()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 00:09:11 +00:00
co-authored by Claude Sonnet 4.6
parent 63cfe62340
commit 86db51e00f
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -37,7 +37,7 @@ def get_people() -> list[dict]:
)
resp.raise_for_status()
return resp.json().get("people", [])
except requests.RequestException as e:
except (requests.RequestException, ValueError) as e:
logger.error(f"Failed to fetch people: {e}")
return []
@@ -78,7 +78,7 @@ def fetch_all_assets(person: dict) -> list[dict]:
if len(page_assets) < page_size:
break
except requests.RequestException as e:
except (requests.RequestException, ValueError) as e:
logger.error(f"Exception fetching assets for {name}: {e}")
break