From 6df053305c0f57acf752c54bf1fbdfe0e06c9f91 Mon Sep 17 00:00:00 2001 From: "octo@swiss" Date: Mon, 7 Nov 2022 19:19:44 +0100 Subject: [PATCH] Forgot the HTTP error patch --- MastodonFeedHTML/MastodonFeedHTML.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MastodonFeedHTML/MastodonFeedHTML.py b/MastodonFeedHTML/MastodonFeedHTML.py index fd29d45..8019431 100755 --- a/MastodonFeedHTML/MastodonFeedHTML.py +++ b/MastodonFeedHTML/MastodonFeedHTML.py @@ -9,6 +9,7 @@ from email.mime.base import MIMEBase from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from urllib.request import urlopen, Request +from urllib.error import HTTPError from Config import * MediaDescsBlock = '
Media descriptions
' @@ -205,6 +206,16 @@ def HandleURL(IsFirstRun, URL, Usertag, IncludeRetoots, IncludeReplies, LocalSav return LastEntryIsNew, PageOlder + except HTTPError as e: + if e.code == 404: + print(e) # TODO: Should get the cached images from the local instance + return True, True + else: + if TryCount == MaxTryCount: + return True, True + print(e) + SleepPrint(PageSleep * (1.5**TryCount)) + return False, False except Exception: raise