Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report some specific errors in get_yaml #2234

Merged
merged 2 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 7 additions & 1 deletion modules/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,14 @@ def file_yaml(self, path_to_file, check_empty=False, create=False, start_empty=F

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):
Expand Down
Loading