From 6072da8885c341b4ebe3fa06aa2471fc5248069b Mon Sep 17 00:00:00 2001 From: Chaz Larson Date: Mon, 23 Sep 2024 08:00:27 -0500 Subject: [PATCH] [43] Report some specific errors in get_yaml (#2234) --- CHANGELOG | 1 + VERSION | 2 +- modules/request.py | 8 +++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index ef9f6998..f1bbf21c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -34,4 +34,5 @@ Fixed #2195 an image on the docs was a dead link Fixes sort order of resolution collections Fixes #2228 ".any" not accepted for a variety of imdb_search parameters Fixes `streaming` defaults adding and removing items randomly +Adds error information to help with #2201 Various other Minor Fixes diff --git a/VERSION b/VERSION index 00df4bc1..fe7987cb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.2-build42 +2.0.2-build43 diff --git a/modules/request.py b/modules/request.py index f08e79ae..59dcab77 100644 --- a/modules/request.py +++ b/modules/request.py @@ -107,8 +107,14 @@ class Requests: def get_yaml(self, url, headers=None, params=None, check_empty=False): response = self.get(url, headers=headers, params=params) - if response.status_code >= 400: + if response.status_code == 401: + raise Failed(f"URL Error: Unauthorized - {url}") + if response.status_code == 404: raise Failed(f"URL Error: No file found at {url}") + if response.status_code == 429: + raise Failed(f"URL Error: Too many requests - {url}") + if response.status_code >= 400: + raise Failed(f"URL Error: {response.status_code} on {url}") return YAML(input_data=response.content, check_empty=check_empty) def get_image(self, url, session=None):