Forgot the HTTP error patch

This commit is contained in:
octo@swiss 2022-11-07 19:19:44 +01:00
parent d620cdc4f2
commit 6df053305c
1 changed files with 11 additions and 0 deletions

View File

@ -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 = '<br><details><summary>Media descriptions</summary><ul>\n{Content}</ul></details>'
@ -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