parent
e1b18c5daf
commit
39a887a6f6
1 changed files with 3 additions and 0 deletions
|
@ -5,6 +5,7 @@ import re
|
||||||
import socket
|
import socket
|
||||||
from datetime import date, timedelta
|
from datetime import date, timedelta
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from urllib.error import URLError
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
@ -303,6 +304,8 @@ class AjaxProxy(View):
|
||||||
proxied_request = opener.open(request)
|
proxied_request = opener.open(request)
|
||||||
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:
|
||||||
|
return HttpResponseBadRequest("URL error")
|
||||||
else:
|
else:
|
||||||
status_code = proxied_request.code
|
status_code = proxied_request.code
|
||||||
mimetype = proxied_request.headers.get(
|
mimetype = proxied_request.headers.get(
|
||||||
|
|
Loading…
Reference in a new issue