Merge pull request #1222 from umap-project/proxy-timeout

Add a timeout in proxy
This commit is contained in:
Yohan Boniface 2023-07-22 09:10:36 +02:00 committed by GitHub
commit 0531ca4700
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -336,7 +336,7 @@ class AjaxProxy(View):
request = Request(url, headers=headers) request = Request(url, headers=headers)
opener = build_opener() opener = build_opener()
try: try:
proxied_request = opener.open(request) proxied_request = opener.open(request, timeout=10)
except HTTPError as e: except HTTPError as e:
return HttpResponse(e.msg, status=e.code, content_type="text/plain") return HttpResponse(e.msg, status=e.code, content_type="text/plain")
except URLError: except URLError: