Merge pull request 'Error on map client search' (#340) from 338_Error_on_map_client_search into master
Reviewed-on: SGD-Nord/konova#340
This commit is contained in:
commit
60b6968436
@ -6,6 +6,7 @@ Created on: 19.08.22
|
||||
|
||||
"""
|
||||
import json
|
||||
from json import JSONDecodeError
|
||||
|
||||
import requests
|
||||
from django.contrib.auth.decorators import login_required
|
||||
@ -13,6 +14,8 @@ from django.http import JsonResponse, HttpRequest
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.utils.http import urlencode
|
||||
from django.views import View
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from requests.auth import HTTPDigestAuth
|
||||
|
||||
from konova.sub_settings.proxy_settings import PROXIES, CLIENT_PROXY_AUTH_USER, CLIENT_PROXY_AUTH_PASSWORD
|
||||
@ -57,7 +60,18 @@ class ClientProxyParcelSearch(BaseClientProxyView):
|
||||
def get(self, request: HttpRequest):
|
||||
url = request.META.get("QUERY_STRING")
|
||||
content, response_code = self.perform_url_call(url)
|
||||
body = json.loads(content)
|
||||
try:
|
||||
body = json.loads(content)
|
||||
except JSONDecodeError as e:
|
||||
body = {
|
||||
"totalResultsCount": -1,
|
||||
"geonames": [
|
||||
{
|
||||
"title": _("The external service is currently unavailable.<br>Please try again in a few moments...")
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
if response_code != 200:
|
||||
return JsonResponse({
|
||||
"status_code": response_code,
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user