From 419aafcf112fdb558f2a36fc4d92cd2b7ad2b936 Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Fri, 20 Jan 2023 08:10:56 -0500 Subject: protocols: Show errors instead of hanging or hiding them --- protocol/http.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'protocol/http.py') diff --git a/protocol/http.py b/protocol/http.py index 2f9672c..96428f9 100644 --- a/protocol/http.py +++ b/protocol/http.py @@ -1,5 +1,8 @@ import requests class HttpProtocol(): def get(url): - r = requests.get(url) + try: + r = requests.get(url, timeout=5) + except Exception as e: + return ("text/error", ["error\n", str(e)]) return (r.headers['content-type'].split(';')[0], r) -- cgit 1.4.1