Merge pull request 'fix: Use environment variable directly for Sonarr API key' (#36) from sonarr-api into dev
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Local Docker Build (Dev) / build-dev (push) Successful in 4s
Reviewed-on: #36
This commit was merged in pull request #36.
This commit is contained in:
+2
-2
@@ -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}"
|
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}")
|
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:
|
if response.status_code == 200:
|
||||||
series_results = response.json()
|
series_results = response.json()
|
||||||
if series_results:
|
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"
|
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}")
|
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:
|
if history_response.status_code == 200:
|
||||||
history_data = history_response.json()
|
history_data = history_response.json()
|
||||||
recent_renames = history_data.get("records", [])
|
recent_renames = history_data.get("records", [])
|
||||||
|
|||||||
Reference in New Issue
Block a user