Commit 92ba4208 authored by Gladys Forte's avatar Gladys Forte

Merge branch 'dev' of http://42.61.118.105:7990/scm/rms/api-main-service into gladys-develop

parents 884a930d e8353f0e
......@@ -43,9 +43,14 @@ class Helper:
def _request_method(self, request, final_endpoint, headers):
if request.method == 'GET':
req = requests.get(final_endpoint, headers=headers)
return self._response_data(req.json(),
req.status_code,
self._headers)
if req.headers.get('content-type') == 'application/json':
return self._response_data(req.json(),
req.status_code,
req.headers)
else:
return req
elif request.method == 'POST':
data = copy.deepcopy(request.data)
......
from rest_framework.views import APIView
from rest_framework.response import Response
from .utils import Helper
from django.conf import settings
from django.http import FileResponse
class APIGatewayList(APIView):
......@@ -9,6 +10,19 @@ class APIGatewayList(APIView):
service = kwargs.get('service')
endpoint_url = kwargs.get('endpoint_url')
api = Helper().get_endpoint(request, service, endpoint_url)
if str(type(api)) == "<class 'requests.models.Response'>":
# varifile = f"{settings.BASE_DIR}/test.xlsx"
# filedesciptor = open(varifile, 'wb')
# filedesciptor.write(api.content)
# filedesciptor.close()
# filer = open(varifile, 'rb')
return FileResponse(api, as_attachment=True)
return Response(api['data'],
status=api['status_code'],
headers=api['headers'])
......
......@@ -8,7 +8,7 @@ DATABASE_PORT =
[UAT]
DATABASE_ENGINE = django.db.backends.mysql
DATABASE_NAME = devrms_main_db
DATABASE_NAME = uat_rms_main_db
DATABASE_USER = oneberry
DATABASE_PASSWORD = 0N3Berryt!r
DATABASE_HOST = 52.74.129.178
......@@ -16,14 +16,15 @@ DATABASE_PORT = 3306
[LOCAL]
DATABASE_ENGINE = django.db.backends.mysql
DATABASE_NAME = authenticatordb
DATABASE_NAME = ob_maindb
DATABASE_USER = root
DATABASE_PASSWORD =
DATABASE_HOST =
DATABASE_PORT =
DATABASE_PASSWORD = password
DATABASE_HOST = 127.0.0.1
DATABASE_PORT = 3306
[SETTINGS]
CONFIG = config.settings.uat
[SERVICE]
AUTHENTICATOR_IP = 172.17.0.1:7011
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