From e97ab95c931d3f99fb840403ed3ee974c0c99954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Lemaigre?= <rlemaigre@uliege.be> Date: Mon, 25 Nov 2024 15:40:24 +0100 Subject: [PATCH] issue fixed --- .pylintrc | 22 ++++++++++++++++++++++ flaskapp.py | 8 ++++---- 2 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 .pylintrc diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000..2ec9bc1 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,22 @@ + + +pylint_config = """ +[MASTER] +ignore-patterns= +disable=C0111,C0103 + +[FORMAT] +max-line-length=100 + +[MESSAGES CONTROL] +disable=missing-docstring,invalid-name + +[DESIGN] +max-args=4 +max-attributes=7 +""" + +with open('.pylintrc', 'w') as config_file: + config_file.write(pylint_config) + +print("Pylint configuration file created at project root.") \ No newline at end of file diff --git a/flaskapp.py b/flaskapp.py index e670294..f7413d9 100644 --- a/flaskapp.py +++ b/flaskapp.py @@ -1,4 +1,5 @@ -# Write a python code which creates a server which guesses a number between 1 and 11, and then responds to https requests to say if they got the guess right or wrong. +# Write a python code which creates a server which guesses a number between 1 and 11, and then +# responds to https requests to say if they got the guess right or wrong. # It should be a server that can handle http requests and understand json data. import random @@ -9,7 +10,6 @@ app = Flask(__name__) # Generate a random number between 1 and 11 secret_number = random.randint(1, 11) - @app.route('/guess', methods=['POST']) def guess_number(): data = request.get_json() @@ -24,8 +24,8 @@ def guess_number(): if user_guess == secret_number: return jsonify({"result": "Correct! You guessed the right number."}), 200 - else: - return jsonify({"result": "Wrong guess. Try again!"}), 200 + + return jsonify({"result": "Wrong guess. Try again!"}), 200 if __name__ == '__main__': -- GitLab