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