From 94f98c3d417a0aceb5ecc13c3f7949fec495b31e Mon Sep 17 00:00:00 2001 From: Mehrin Kiani Date: Tue, 21 Nov 2023 17:06:01 -0500 Subject: [PATCH] Remove url support --- modelscan/utils.py | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 modelscan/utils.py diff --git a/modelscan/utils.py b/modelscan/utils.py deleted file mode 100644 index 702e857..0000000 --- a/modelscan/utils.py +++ /dev/null @@ -1,25 +0,0 @@ -import requests -import logging -from typing import Union - -logger = logging.getLogger("modelscan") - - -def fetch_url(url: str, allow_redirect: bool = False) -> Union[None, bytes]: - try: - response = requests.get(url, allow_redirects=allow_redirect, timeout=10) - response.raise_for_status() - return response.content - except requests.exceptions.HTTPError as e: - logger.error("Error with request: %s", e.response.status_code) - logger.error(e.response.text) - return None - except requests.exceptions.JSONDecodeError as e: - logger.error("Response was not valid JSON") - return None - except requests.exceptions.Timeout as e: - logger.error("Request timed out") - return None - except Exception as e: - logger.error("Unexpected error during request to %s: %s", url, str(e)) - return None