From 64559d36681c050379d4f80175fad06a22532d97 Mon Sep 17 00:00:00 2001 From: CakesTwix Date: Sat, 1 Feb 2025 17:01:14 +0200 Subject: [PATCH] Added some try catch --- app/api/titles.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/api/titles.py b/app/api/titles.py index eb67b66..a768984 100644 --- a/app/api/titles.py +++ b/app/api/titles.py @@ -29,9 +29,16 @@ def titles_route(): if image_cache: titles[title]["image"] = image_cache.image else: - toloka_torrent = config.toloka.get_torrent( - f"https://toloka.to/{titles[title]['guid']}" - ) + try: + toloka_torrent = config.toloka.get_torrent( + f"https://toloka.to/{titles[title]['guid']}" + ) + except AttributeError as e: + print(f"https://toloka.to/{titles[title]['guid']}") + config.logger.warning( + f"Failed to get https://toloka.to/{titles[title]['guid']} torrent: {str(e)}" + ) + pass toloka_img = ( f"https:{toloka_torrent.img}" if toloka_torrent.img.startswith("//")