Konova views
* splits konova/views.py into separate files in new module
* view files can now be found in /konova/views/...
* introduces first class based view AbstractLogView
* implemented for Ema, Intervention, Compensation and EcoAccount
This commit is contained in:
35
konova/views/map_proxy.py
Normal file
35
konova/views/map_proxy.py
Normal file
@@ -0,0 +1,35 @@
|
||||
"""
|
||||
Author: Michel Peltriaux
|
||||
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
||||
Contact: ksp-servicestelle@sgdnord.rlp.de
|
||||
Created on: 19.08.22
|
||||
|
||||
"""
|
||||
import json
|
||||
|
||||
import requests
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.http import JsonResponse, HttpRequest
|
||||
|
||||
|
||||
@login_required
|
||||
def map_client_proxy_view(request: HttpRequest):
|
||||
""" Provides proxy functionality for NETGIS map client.
|
||||
|
||||
Used for fetching content of a provided url
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
url = request.META.get("QUERY_STRING")
|
||||
response = requests.get(url)
|
||||
body = json.loads(response.content)
|
||||
if response.status_code != 200:
|
||||
return JsonResponse({
|
||||
"status_code": response.status_code,
|
||||
"content": body,
|
||||
})
|
||||
return JsonResponse(body)
|
||||
Reference in New Issue
Block a user