Broken project to implement a cross-protocol browser in textual
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) |