Skip to content

Commit b41b7e5

Browse files
Birger SchachtBirger Schacht
authored andcommitted
FIX: manager expects a string as return value
1 parent 2fdb8f1 commit b41b7e5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

intelmq_api/api.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,12 @@ def get_runtime():
215215

216216
@hug.post("/api/runtime", requires=token_authentication, version=1)
217217
def post_runtime(body):
218-
return utils.set_runtime(body)
218+
try:
219+
utils.set_runtime(body)
220+
return "success"
221+
except Exception as e:
222+
print(f"Could not write runtime {str(e)}")
223+
return str(e)
219224

220225

221226
@hug.get("/api/positions", requires=token_authentication, versions=1)
@@ -240,7 +245,7 @@ def post_positions(body):
240245
try:
241246
positions.parent.mkdir(exist_ok=True)
242247
positions.write_text(json.dumps(body, indent=4))
243-
return json.loads(positions.read_text())
248+
return "success"
244249
except OSError as e:
245250
print(f"Error creating {positions.parent} or writing to {positions}: {str(e)}")
246-
return {}
251+
return str(e)

0 commit comments

Comments
 (0)