Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
red-ci-cd
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
red-group-test
red-ci-cd
Commits
92ba4208
Commit
92ba4208
authored
Aug 13, 2019
by
Gladys Forte
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://42.61.118.105:7990/scm/rms/api-main-service
into gladys-develop
parents
884a930d
e8353f0e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
9 deletions
+29
-9
api/utils.py
api/utils.py
+8
-3
api/views.py
api/views.py
+15
-1
env.template.ini
env.template.ini
+6
-5
No files found.
api/utils.py
View file @
92ba4208
...
...
@@ -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
)
...
...
api/views.py
View file @
92ba4208
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'
])
...
...
env.template.ini
View file @
92ba4208
...
...
@@ -8,7 +8,7 @@ DATABASE_PORT =
[UAT]
DATABASE_ENGINE
=
django.db.backends.mysql
DATABASE_NAME
=
dev
rms_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
=
authenticator
db
DATABASE_NAME
=
ob_main
db
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment