Commit 4ac6ad22 authored by John Red Medrano's avatar John Red Medrano

remove unused codes

parent 1db3b802
from api.viewsets.applications import ApplicationViewSet, GroupDependentViewSet
from api.viewsets.services import APIServiceViewSet
from api.viewsets.endpoints import APIEndpointViewSet
from django.urls import path, include
from rest_framework.routers import DefaultRouter, SimpleRouter
from rest_framework.routers import DefaultRouter
from api.viewsets.services import APIServiceViewSet
from api.viewsets.endpoints import APIEndpointViewSet
from api.viewsets.applications import ApplicationViewSet, GroupDependentViewSet
from api.views import (
APIGatewayList, APIGatewaySlugDetail, APIGatewaySlugModelDetail
)
......
......@@ -9,6 +9,7 @@ from .models import APIEndpoint
from rest_framework.pagination import PageNumberPagination
from rest_framework.response import Response
import datetime
from functools import wraps
VALIDATE_TOKEN_URL = settings.VALIDATE_TOKEN_URL
......@@ -90,18 +91,22 @@ class Helper:
service__name=service,
endpoint_url=endpoint_url,
)
if endpoint.is_active is True:
base_url = endpoint.service.base_url
full_path = request.get_full_path()
final_endpoint = f"{base_url}{full_path}"
if endpoint.is_need_auth is True:
# redirect to authenticator service
self._headers = {
'Authorization': request.META['HTTP_AUTHORIZATION'],
"endpoint": endpoint.endpoint_url
'Content-Type': 'application/json',
"endpoint": str(endpoint.id)
}
req = requests.post(VALIDATE_TOKEN_URL,
headers=self._headers)
print(req)
all_headers = {**req.headers, **self._headers}
if req.status_code == 200:
......@@ -156,7 +161,6 @@ def number_generator(prefix, id):
# status message
def status_message_response(code, status, message, results):
print('ddd')
message = {
'code': code,
'status': status,
......
from rest_framework import viewsets, status
from rest_framework.views import APIView
from rest_framework.decorators import action
from rest_framework.response import Response
from django_filters.rest_framework import DjangoFilterBackend
from .models import APIService, APIEndpoint, Application
from .utils import (APIEndpointFilter, Helper)
from .utils import Helper
class APIGatewayList(APIView):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment