From 4fa26f8ad0859e64b81e6e3f1795d26557870705 Mon Sep 17 00:00:00 2001 From: pseusys Date: Wed, 22 Feb 2023 08:08:02 +0100 Subject: [PATCH] None repository error fixed --- sources/download_manager.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sources/download_manager.py b/sources/download_manager.py index 6df7cc7..3ea011c 100644 --- a/sources/download_manager.py +++ b/sources/download_manager.py @@ -223,16 +223,16 @@ class DownloadManager: } } Where `...` states for any number of dictionaries containing _one single key_ only. - If the structure of the response isn't met, an exception is thrown! + If the structure of the response isn't met, a tuple of empty list and dist with only `hasNextPage=False` is returned! :param response: Response JSON dictionary. :returns: Tuple of the acquired pagination data list ("nodes" key) and pagination info dict ("pageInfo" key). """ if "nodes" in response.keys() and "pageInfo" in response.keys(): return response["nodes"], response["pageInfo"] - elif len(response) == 1: + elif len(response) == 1 and isinstance(response[list(response.keys())[0]], Dict): return DownloadManager._find_pagination_and_data_list(response[list(response.keys())[0]]) else: - raise RuntimeError(f"Received structure '{response}' isn't a paginated response!") + return list(), dict(hasNextPage=False) @staticmethod async def _fetch_graphql_paginated(query: str, **kwargs) -> Dict: