Dateien hochladen nach „REST/old“

Lock Object
main
Thomas Hassenstein 2023-06-13 18:48:39 +02:00
parent 48d201f964
commit 673c3f1e39
1 changed files with 14 additions and 14 deletions

View File

@ -52,21 +52,21 @@ def get_random_numbers():
return create_response(432, 'System not ready; try init')
with lock: # Sperre (Lock) verwenden, um sicherzustellen, dass nur ein Thread die Methode ausführt
random_numbers = analyze_data(int(quantity), int(bits), startup=False)
random_numbers = analyze_data(int(quantity), int(bits), startup=False)
if random_numbers == 400:
return create_response(500, 'Tests failed, try again')
if random_numbers is False:
return create_response(500, 'Unable to generate random numbers. Restart/Reset System')
if random_numbers:
data = {
'status': 200,
'description': 'Successful operation; HEX-encoded bit arrays (with leading zeros if required)',
'randomNumbers': random_numbers
}
return jsonify(data)
else:
return create_response(500, 'Unable to generate random numbers.')
if random_numbers == 400:
return create_response(543, 'Tests failed, try again')
if random_numbers is False:
return create_response(500, 'Unable to generate random numbers. Restart/Reset System')
if random_numbers:
data = {
'status': 200,
'description': 'Successful operation; HEX-encoded bit arrays (with leading zeros if required)',
'randomNumbers': random_numbers
}
return jsonify(data)
else:
return create_response(500, 'Unable to generate random numbers.')
@app.route('/trng/randomNum/shutdown', methods=['GET'])
def shutdown_generator():