diff --git a/REST/old/app.py b/REST/old/app.py index ddd96db..b45889c 100644 --- a/REST/old/app.py +++ b/REST/old/app.py @@ -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():