fix: Use environment variable directly for Sonarr API key
Local Docker Build (Dev) / build-dev (pull_request) Successful in 4s

- Changed from config.sonarr_api_key to os.environ.get('SONARR_API_KEY', '')
- Matches pattern used in tv_processor.py for Sonarr API access
This commit is contained in:
2025-10-10 11:17:02 -04:00
parent d12a634dd1
commit 4dff85c5c9
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -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", [])