From f67cf22b71ae7eddb7952ce315825ecb95af2c29 Mon Sep 17 00:00:00 2001 From: jwansek Date: Thu, 11 Mar 2021 00:31:08 +0000 Subject: fixed bug where it threw an error when it couldnt get an image --- services.py | 3 ++- static/images/random.jpg | Bin 624236 -> 220231 bytes 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/services.py b/services.py index 8531c6b..d2ae979 100644 --- a/services.py +++ b/services.py @@ -169,7 +169,8 @@ def get_random_image(tags): try: element = random.choice(imageElements) except IndexError: - raise ConnectionError("Couldn't find any images") + # raise ConnectionError("Couldn't find any images") + return get_random_image(tags) url = "https://safebooru.org/" + element.get("href") if get_id_from_url(url) == theLastId: diff --git a/static/images/random.jpg b/static/images/random.jpg index 5654cca..ec22717 100755 Binary files a/static/images/random.jpg and b/static/images/random.jpg differ -- cgit v1.2.3