Better error handling
This commit is contained in:
parent
63d4a722f1
commit
a2d691dbf9
8
app.py
8
app.py
@ -1,5 +1,6 @@
|
||||
import time
|
||||
from logging import getLogger
|
||||
from operator import attrgetter, itemgetter
|
||||
from time import sleep
|
||||
|
||||
from flask import redirect, render_template, request, url_for
|
||||
|
||||
@ -182,6 +183,7 @@ if __name__ == '__main__':
|
||||
while True:
|
||||
try:
|
||||
app.run('0.0.0.0', APP_PORT, IS_DEBUG)
|
||||
except Exception:
|
||||
time.sleep(10)
|
||||
except Exception as e:
|
||||
getLogger().exception(e)
|
||||
sleep(10)
|
||||
pass
|
||||
|
@ -10,7 +10,6 @@ from urllib.parse import quote
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from requests import Timeout
|
||||
|
||||
from config import IS_DEBUG, CACHE_TIMEOUT, BLACKLIST_WORDS
|
||||
from models import AnimeLink
|
||||
@ -164,7 +163,7 @@ class Connector(ABC):
|
||||
|
||||
output = response.text
|
||||
http_code = response.status_code
|
||||
except Timeout as e:
|
||||
except requests.Timeout as e:
|
||||
output = ''
|
||||
http_code = 500
|
||||
if IS_DEBUG:
|
||||
|
Reference in New Issue
Block a user