def query_store_api(request, path=None): response = {'status': -1} if USE_PROXY.get(): content_type = 'application/json; charset=UTF-8' headers = {'X-Requested-By': 'das', 'Content-Type': content_type} client = HttpClient(QUERY_STORE.SERVER_URL.get()) resource = Resource(client) if USE_SASL.get(): client.set_kerberos_auth() try: response = resource.invoke(request.method, path, request.GET.dict(), request.body, headers) except RestException as e: ex_response = e.get_parent_ex().response response['code'] = ex_response.status_code response['message'] = ex_response.reason response['content'] = ex_response.text else: if path == 'api/query/search': filters = json.loads(request.body) resp = get_api(request.user, interface='queries-hive').apps(filters['search']) response = resp['apps'] return JsonResponse(response)
def query_store_api(request, path=None): response = {'status': -1} if USE_PROXY.get(): response = query_store_proxy(request, path) else: if path == 'api/query/search': filters = json.loads(request.body) resp = get_api(request.user, interface='queries-hive').apps(filters['search']) response = resp['apps'] return JsonResponse(response)