diff --git a/scripts/status_check.py b/scripts/status_check.py index e8a1ad3..7c4d6a0 100644 --- a/scripts/status_check.py +++ b/scripts/status_check.py @@ -13,7 +13,7 @@ from src.utils import ( apk_mirror_base_url, apkmirror_status_check, bs4_parser, - handle_github_response, + handle_request_response, ) not_found_icon = "https://img.icons8.com/bubbles/500/android-os.png" @@ -103,7 +103,7 @@ def generate_markdown_table(data: List[List[str]]) -> str: def main() -> None: repo_url = "https://releases.revanced.app/patches" response = requests.get(repo_url, timeout=10) - handle_github_response(response) + handle_request_response(response) patches = response.json() diff --git a/src/downloader/download.py b/src/downloader/download.py index a0c8c6f..b2a5e3e 100644 --- a/src/downloader/download.py +++ b/src/downloader/download.py @@ -13,7 +13,7 @@ from src.config import RevancedConfig from src.downloader.utils import implement_method from src.exceptions import DownloadFailure from src.patches import Patches -from src.utils import handle_github_response +from src.utils import handle_request_response class Downloader(object): @@ -55,7 +55,7 @@ class Downloader(object): stream=True, headers=headers, ) - handle_github_response(response) + handle_request_response(response) total = int(response.headers.get("content-length", 0)) bar = tqdm( desc=file_name, diff --git a/src/downloader/github.py b/src/downloader/github.py index 135dec5..3fbc973 100644 --- a/src/downloader/github.py +++ b/src/downloader/github.py @@ -9,7 +9,7 @@ from loguru import logger from src.config import RevancedConfig from src.downloader.download import Downloader from src.exceptions import DownloadFailure -from src.utils import handle_github_response, update_changelog +from src.utils import handle_request_response, update_changelog class Github(Downloader): @@ -36,7 +36,7 @@ class Github(Downloader): logger.debug("Using personal access token") headers["Authorization"] = f"token {self.config.personal_access_token}" response = requests.get(repo_url, headers=headers, timeout=60) - handle_github_response(response) + handle_request_response(response) if repo_name == "revanced-patches": download_url = response.json()["assets"][1]["browser_download_url"] else: @@ -80,7 +80,7 @@ class Github(Downloader): if config.personal_access_token: headers["Authorization"] = f"token {config.personal_access_token}" response = requests.get(api_url, headers=headers, timeout=60) - handle_github_response(response) + handle_request_response(response) assets = response.json()["assets"] try: filter_pattern = re.compile(asset_filter) diff --git a/src/utils.py b/src/utils.py index bb6571a..6ae68ec 100644 --- a/src/utils.py +++ b/src/utils.py @@ -67,13 +67,11 @@ def get_parent_repo() -> str: return "https://github.com/nikhilbadyal/docker-py-revanced" -def handle_github_response(response: Response) -> None: +def handle_request_response(response: Response) -> None: """Handle Get Request Response.""" response_code = response.status_code if response_code != 200: - raise DownloadFailure( - f"Unable to downloaded assets from GitHub. Reason - {response.text}" - ) + raise DownloadFailure(f"Unable to downloaded assets. Reason - {response.text}") def slugify(string: str) -> str: