From 4dff85c5c91dfc90c995fc07d75310632deb2e7e Mon Sep 17 00:00:00 2001 From: sbcrumb Date: Fri, 10 Oct 2025 11:17:02 -0400 Subject: [PATCH] fix: Use environment variable directly for Sonarr API key - Changed from config.sonarr_api_key to os.environ.get('SONARR_API_KEY', '') - Matches pattern used in tv_processor.py for Sonarr API access --- VERSION | 2 +- api/routes.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index b8061b5..a14da29 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.15 +2.0.16 diff --git a/api/routes.py b/api/routes.py index 6f4a952..7f9921c 100644 --- a/api/routes.py +++ b/api/routes.py @@ -110,7 +110,7 @@ async def sonarr_webhook(request: Request, background_tasks: BackgroundTasks, de series_lookup_url = f"{config.sonarr_url}/api/v3/series/lookup?term=imdbid:{imdb_id}" print(f"DEBUG: Sonarr lookup for rename: {series_lookup_url}") - response = requests.get(series_lookup_url, headers={"X-Api-Key": config.sonarr_api_key}, timeout=10) + response = requests.get(series_lookup_url, headers={"X-Api-Key": os.environ.get("SONARR_API_KEY", "")}, timeout=10) if response.status_code == 200: series_results = response.json() if series_results: @@ -123,7 +123,7 @@ async def sonarr_webhook(request: Request, background_tasks: BackgroundTasks, de history_url = f"{config.sonarr_url}/api/v3/history?seriesId={series_id}&eventType=episodeFileRenamed&since={since_date}&pageSize=10" print(f"DEBUG: Checking recent rename history: {history_url}") - history_response = requests.get(history_url, headers={"X-Api-Key": config.sonarr_api_key}, timeout=10) + history_response = requests.get(history_url, headers={"X-Api-Key": os.environ.get("SONARR_API_KEY", "")}, timeout=10) if history_response.status_code == 200: history_data = history_response.json() recent_renames = history_data.get("records", [])