# Netgis client update
* integrates newest netgis map client * generalizes map proxy response handling
This commit is contained in:
@@ -10,11 +10,10 @@ from json import JSONDecodeError
|
||||
|
||||
import requests
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.http import JsonResponse, HttpRequest
|
||||
from django.http import JsonResponse, HttpRequest, HttpResponse
|
||||
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
|
||||
|
||||
@@ -60,24 +59,7 @@ class ClientProxyParcelSearch(BaseClientProxyView):
|
||||
def get(self, request: HttpRequest):
|
||||
url = request.META.get("QUERY_STRING")
|
||||
content, response_code = self.perform_url_call(url)
|
||||
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,
|
||||
"content": body,
|
||||
})
|
||||
return JsonResponse(body)
|
||||
return HttpResponse(content)
|
||||
|
||||
|
||||
class ClientProxyParcelWFS(BaseClientProxyView):
|
||||
|
||||
Reference in New Issue
Block a user