Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
services
Import Process
Import API
Commits
195a60bc
Commit
195a60bc
authored
Apr 12, 2021
by
Jonas Waeber
Browse files
Fix style
parent
929c9284
Pipeline
#24471
passed with stages
in 2 minutes and 14 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
import_api_app/resources/WriteTypeReportToDrupal.py
View file @
195a60bc
...
...
@@ -46,10 +46,10 @@ class WriteTypeReportToDrupal(Resource):
"""
try
:
node_type
=
request
.
json
[
0
][
'node_type'
]
identifier
=
request
.
json
[
0
][
'id'
]
status
=
request
.
json
[
0
][
'status'
]
report
=
request
.
json
[
0
][
'report'
]
node_type
=
request
.
json
[
'node_type'
]
identifier
=
request
.
json
[
'id'
]
status
=
request
.
json
[
'status'
]
report
=
request
.
json
[
'report'
]
except
KeyError
as
er
:
return
{
'message'
:
f
'Missing a element in input body:
{
er
}
'
...
...
@@ -79,7 +79,14 @@ def get_node_id(memobase_id: str):
response
=
requests
.
get
(
url
,
headers
=
headers
)
if
response
.
ok
:
return
response
.
json
()[
'data'
][
0
][
'attributes'
][
'id'
]
try
:
return
response
.
json
()[
'data'
][
0
][
'attributes'
][
'id'
]
except
KeyError
as
er
:
current_app
.
logger
.
error
(
f
"Could not find the key
{
er
}
in data:
{
response
.
text
}
."
)
raise
ImportApiError
(
f
"Could not find the key
{
er
}
in data:
{
response
.
text
}
."
)
except
IndexError
:
current_app
.
logger
.
error
(
f
"Data field does not contain a list:
{
response
.
text
}
."
)
raise
ImportApiError
(
f
"Data field does not contain a list:
{
response
.
text
}
."
)
else
:
raise
ImportApiError
(
f
"Could not find element for report:
{
response
.
text
}
."
)
...
...
Write
Preview
Supports
Markdown
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