Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
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
55628b4c
Commit
55628b4c
authored
May 11, 2021
by
Jonas Waeber
Browse files
Merge branch 'master' of gitlab.switch.ch:memoriav/memobase-2020/services/import-process/import-api
parents
1424b5b7
2481172d
Pipeline
#26230
passed with stages
in 1 minute and 59 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
import_api_app/resources/WriteJobResultsToDrupal.py
View file @
55628b4c
...
...
@@ -119,14 +119,19 @@ def write_results(job_drupal_uuid, job_log_drupal_uuid, status, report):
getUrl
=
current_app
.
config
[
'drupal-api-url'
]
+
\
'/jsonapi/node/log_result/'
+
job_log_drupal_uuid
response
=
requests
.
get
(
getUrl
,
headers
=
headers
,
auth
=
auth
)
logResult
=
response
.
json
()[
'data'
]
previous_status
=
logResult
[
'attributes'
][
'field_status'
]
previous_report
=
logResult
[
'attributes'
][
'field_message'
]
try
:
logResult
=
response
.
json
()[
'data'
]
previous_status
=
logResult
[
'attributes'
][
'field_status'
]
previous_report
=
logResult
[
'attributes'
][
'field_message'
]
except
Exception
:
msg
=
'could not parse response from '
+
getUrl
current_app
.
logger
.
error
(
msg
)
except
requests
.
exceptions
.
RequestException
:
message
=
'It was not possible to read form the Drupal API:'
+
getUrl
+
\
'
\n
response: '
+
response
current_app
.
logger
.
error
(
message
)
raise
ImportApiError
(
message
)
if
previous_status
==
'FAILED'
:
status
=
previous_status
if
previous_report
is
None
or
previous_report
==
'null'
:
...
...
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