Skip to content

Commit

Permalink
handle API server fail
Browse files Browse the repository at this point in the history
  • Loading branch information
Tmaster055 committed Nov 26, 2024
1 parent 3acf495 commit b4b94a2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/aniworld/aniskip/aniskip.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,18 @@ def build_flags(anime_id: str, episode: int, chapters_file: str) -> str:
response = requests.get(
aniskip_api,
headers={"User-Agent": aniworld_globals.DEFAULT_USER_AGENT},
timeout=10
timeout=15
)
logging.debug("Response status code: %d", response.status_code)


if response.status_code == 500:
logging.info("Aniskip API is currently not working!")
return ""
if response.status_code != 200:
raise_runtime_error("Failed to fetch AniSkip data.")


metadata = response.json()
logging.debug("AniSkip response: %s", json.dumps(metadata, indent=2))

Expand Down

0 comments on commit b4b94a2

Please sign in to comment.