From 673c3f1e396f3ae054128698cb3a0307b76ba81c Mon Sep 17 00:00:00 2001 From: Thomas Hassenstein <2021544@stud.hs-mannheim.de> Date: Tue, 13 Jun 2023 18:48:39 +0200 Subject: [PATCH] =?UTF-8?q?Dateien=20hochladen=20nach=20=E2=80=9EREST/old?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lock Object --- REST/old/app.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) 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():