diff --git a/if_curator/cli.py b/if_curator/cli.py index 3840930..7283fd8 100644 --- a/if_curator/cli.py +++ b/if_curator/cli.py @@ -12,7 +12,7 @@ from rich.progress import BarColumn, Progress, SpinnerColumn, TaskProgressColumn from rich.prompt import Confirm, IntPrompt, Prompt from rich.table import Table -from .config import Config, ConfigManager +from .config import Config, ConfigManager, get_headers from .diversity import select_diverse_assets from .embeddings import is_embedding_available, load_embedding_model from .image_processing import process_face_mode, process_full_mode, process_object_mode @@ -541,7 +541,7 @@ def execute_jobs(jobs: list[dict]) -> None: else: resp = requests.get( f"{Config.IMMICH_URL}/api/assets/{asset['id']}/thumbnail?size=preview&format=JPEG", - headers={"x-api-key": Config.API_KEY, "Accept": "application/json"}, + headers=get_headers(), timeout=30, ) img = Image.open(BytesIO(resp.content)) if resp.ok else None diff --git a/if_curator/immich_api.py b/if_curator/immich_api.py index dc8d826..3159c28 100644 --- a/if_curator/immich_api.py +++ b/if_curator/immich_api.py @@ -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