Commit c064197d authored by Gladys Forte's avatar Gladys Forte

download api

parent 92ba4208
......@@ -3,6 +3,7 @@ from rest_framework.response import Response
from .utils import Helper
from django.conf import settings
from django.http import FileResponse
import requests
class APIGatewayList(APIView):
......@@ -91,3 +92,12 @@ class APIGatewaySlugModelDetail(APIView):
def delete(self, request, format=None, **kwargs):
return self._response(request, **kwargs)
class Download(APIView):
def post(self, request, **kwargs):
print("hello")
req = requests.get(request.body.get("url"))
return FileResponse(req, as_attachment=True)
......@@ -33,4 +33,4 @@ AUTHENTICATOR_IP = config['SERVICE']['AUTHENTICATOR_IP']
AUTHENTICATOR_PATH = '/api/v1/authenticator'
VALIDATE_TOKEN_URL = f'http://{AUTHENTICATOR_IP}{AUTHENTICATOR_PATH}/authenticator-validate-token/'
AUTHENTICATOR_GROUP = f'http://{AUTHENTICATOR_IP}{AUTHENTICATOR_PATH}/authenticator-group'
AUTHENTICATOR_GROUP = f'http://{AUTHENTICATOR_IP}{AUTHENTICATOR_PATH}/authenticator-group'
\ No newline at end of file
......@@ -33,4 +33,4 @@ AUTHENTICATOR_IP = config['SERVICE']['AUTHENTICATOR_IP']
AUTHENTICATOR_PATH = '/api/v1/authenticator'
VALIDATE_TOKEN_URL = f'http://{AUTHENTICATOR_IP}{AUTHENTICATOR_PATH}/authenticator-validate-token/'
AUTHENTICATOR_GROUP = f'http://{AUTHENTICATOR_IP}{AUTHENTICATOR_PATH}/authenticator-group'
AUTHENTICATOR_GROUP = f'http://{AUTHENTICATOR_IP}{AUTHENTICATOR_PATH}/authenticator-group'
\ No newline at end of file
......@@ -15,10 +15,12 @@ Including another URLconf
"""
from django.urls import path, include
from rest_framework_swagger.views import get_swagger_view
from api.views import (Download)
swagger = get_swagger_view(title='API Main End Point')
urlpatterns = [
path('docs/', swagger),
path('api/v1/', include('api.urls')),
path('api/v1/download/', Download.as_view()),
]
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