mirror of https://github.com/CIRCL/lookyloo
fix: Properly handle the optional responses
parent
5e72e1104e
commit
f5c1c14c4d
|
@ -633,8 +633,12 @@ def monitor(tree_uuid: str):
|
|||
collection: str = request.form['collection'] if request.form.get('collection') else ''
|
||||
frequency: str = request.form['frequency'] if request.form.get('frequency') else 'daily'
|
||||
cache = lookyloo.capture_cache(tree_uuid)
|
||||
monitoring_uuid = lookyloo.monitoring.monitor({'url': cache.url}, frequency=frequency, collection=collection)
|
||||
flash(f"Sent to monitoring: {monitoring_uuid}", 'success')
|
||||
if cache:
|
||||
monitoring_uuid = lookyloo.monitoring.monitor({'url': cache.url, 'user_agent': cache.user_agent},
|
||||
frequency=frequency, collection=collection)
|
||||
flash(f"Sent to monitoring: {monitoring_uuid}", 'success')
|
||||
else:
|
||||
flash(f"Unable to send to monitoring, uuid {tree_uuid} not found in cache.", 'error')
|
||||
return redirect(url_for('tree', tree_uuid=tree_uuid))
|
||||
|
||||
|
||||
|
|
|
@ -462,9 +462,12 @@ class CompareCaptures(Resource):
|
|||
result = comparator.compare_captures(left_uuid, right_uuid)
|
||||
except MissingUUID as e:
|
||||
# UUID non-existent, or capture still ongoing.
|
||||
status_left = lookyloo.get_capture_status(left_uuid)
|
||||
status_right = lookyloo.get_capture_status(right_uuid)
|
||||
return {'error': e, 'details': {left_uuid: status_left, right_uuid: status_right}}
|
||||
if left_uuid and right_uuid:
|
||||
status_left = lookyloo.get_capture_status(left_uuid)
|
||||
status_right = lookyloo.get_capture_status(right_uuid)
|
||||
return {'error': e, 'details': {left_uuid: status_left, right_uuid: status_right}}
|
||||
else:
|
||||
return {'error': e, 'details': 'Invalid request (left/right UUIDs missing.)'}
|
||||
return result
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue