diff options
| author | Zach DeCook <zachdecook@librem.one> | 2023-01-20 08:10:56 -0500 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2023-01-20 08:10:56 -0500 |
| commit | 419aafcf112fdb558f2a36fc4d92cd2b7ad2b936 (patch) | |
| tree | 5e6d21267aadb5470b311bfba4f71a59ca4f54bc /protocol/http.py | |
| parent | 7682658a6d9a0e167fe22debcbee77522b42be92 (diff) | |
| download | browset-419aafcf112fdb558f2a36fc4d92cd2b7ad2b936.tar.gz | |
protocols: Show errors instead of hanging or hiding them
Diffstat (limited to 'protocol/http.py')
| -rw-r--r-- | protocol/http.py | 5 |
1 files changed, 4 insertions, 1 deletions
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) |
