From b88c475459c140bd9b5ae95cdd1583c41dee94f9 Mon Sep 17 00:00:00 2001 From: Spoked <5782630+dreulavelle@users.noreply.github.com> Date: Tue, 11 Jun 2024 11:17:58 -0400 Subject: [PATCH] fix: change mdblist str to int (#382) Co-authored-by: Spoked --- backend/program/content/mdblist.py | 10 +++++----- backend/program/content/overseerr.py | 2 +- backend/program/settings/models.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/program/content/mdblist.py b/backend/program/content/mdblist.py index 7b7dcb8e..3cd4b489 100644 --- a/backend/program/content/mdblist.py +++ b/backend/program/content/mdblist.py @@ -26,12 +26,12 @@ def validate(self): if not self.settings.enabled: logger.warning("Mdblist is set to disabled.") return False - if self.settings.lists == [""]: - logger.error("Mdblist is enabled, but list is empty.") - return False if self.settings.api_key == "" or len(self.settings.api_key) != 25: logger.error("Mdblist api key is not set.") return False + if not self.settings.lists: + logger.error("Mdblist is enabled, but list is empty.") + return False response = ping(f"https://mdblist.com/api/user?apikey={self.settings.api_key}") if "Invalid API key!" in response.text: logger.error("Mdblist api key is invalid.") @@ -71,7 +71,7 @@ def my_limits(api_key: str): return response.data -def list_items(list_id: str, api_key: str): +def list_items(list_id: int, api_key: str): """Wrapper for mdblist api method 'List items'""" - response = get(f"http://www.mdblist.com/api/lists/{list_id}/items?apikey={api_key}") + response = get(f"http://www.mdblist.com/api/lists/{str(list_id)}/items?apikey={api_key}") return response.data diff --git a/backend/program/content/overseerr.py b/backend/program/content/overseerr.py index 03432788..d1b70e15 100644 --- a/backend/program/content/overseerr.py +++ b/backend/program/content/overseerr.py @@ -35,7 +35,7 @@ def validate(self) -> bool: response = ping( self.settings.url + "/api/v1/auth/me", additional_headers=self.headers, - timeout=15, + timeout=30, ) if response.status_code >= 201: logger.error( diff --git a/backend/program/settings/models.py b/backend/program/settings/models.py index c0fb73b9..e463cb5d 100644 --- a/backend/program/settings/models.py +++ b/backend/program/settings/models.py @@ -76,7 +76,7 @@ class ListrrModel(Updatable): class MdblistModel(Updatable): enabled: bool = False api_key: str = "" - lists: list[str] = [] + lists: list[int] = [] update_interval: int = 300