Commit 5412ef2b authored by Matthias's avatar Matthias
Browse files

respect parameter for uuid

parent d926c45e
Pipeline #11213 passed with stages
in 6 minutes and 40 seconds
......@@ -16,7 +16,7 @@ class MonitorDrupalJsonApiInstitution(Resource):
- Monitor Drupal JSON API
parameters:
- in: path
name: topic_value
name: topic_name
required: true
description: The UUID of the updated institution
example: institutionXYZ-235323B
......@@ -43,8 +43,8 @@ class MonitorDrupalJsonApiInstitution(Resource):
# 1. request info from drupal with received uuid
try:
drupalResponse =\
requests.get('https://mb-wf1.memobase.unibas.ch/jsonapi/node/institution/'
+ '0c4c777c-94f8-45ba-945a-bfe6967d40da').json()['data']
requests.get('https://mb-wf1.memobase.unibas.ch/jsonapi/node/' +
'institution/' + topic_name).json()['data']
topicValue = {
'title': drupalResponse['attributes']['title'],
'field_address': drupalResponse['attributes']['field_address'],
......@@ -60,10 +60,8 @@ class MonitorDrupalJsonApiInstitution(Resource):
report += 'Exception' + str(ex) + '\n'
# 2. write info into kafka topic
# use kafka-procuder and topic 'drupal-json-api-institutions'
# use kafka-producer and topic 'drupal-json-api-institutions'
try:
# producer = KafkaProducer(bootstrap_servers=current_app.config['kafka-broker-url'])
# future = producer.send('drupal-json-api-institutions', "str(topicValue)")
producer = KafkaProducer(bootstrap_servers=current_app.config['kafka-broker-url'],
value_serializer=lambda m: json.dumps(m).encode('ascii'))
producer.send('drupal-json-api-institutions', topicValue)
......
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