fix api client context manager

This commit is contained in:
maxid
2025-12-28 14:01:54 +01:00
parent 6993ec8752
commit 0da3e53bcb

View File

@@ -52,7 +52,7 @@ class Prowlarr(GenericIndexer):
@contextmanager @contextmanager
def __get_api(self): def __get_api(self):
with prowlarr.ApiClient(self.config) as api_instance: with prowlarr.ApiClient(self.config) as api_instance:
yield prowlarr.IndexerApi(api_instance) yield api_instance
def __get_indexers(self) -> list[IndexerInfo]: def __get_indexers(self) -> list[IndexerInfo]:
with self.__get_api() as client: with self.__get_api() as client:
@@ -178,7 +178,8 @@ class Prowlarr(GenericIndexer):
def __get_newznab_api(self, searches: list) -> list: def __get_newznab_api(self, searches: list) -> list:
results = [] results = []
with prowlarr.NewznabApi(self.__get_api) as api: with self.__get_api() as api_client:
api = prowlarr.NewznabApi(api_client)
futures = [] futures = []
with ThreadPoolExecutor() as executor: with ThreadPoolExecutor() as executor:
for search in searches: for search in searches: