From 4872319cd1e679e1d3c45eaacf242004d1404392 Mon Sep 17 00:00:00 2001 From: ChevrierVincent <chevrier6@univ-lorraine.fr> Date: Thu, 16 Dec 2021 16:18:45 +0100 Subject: [PATCH] maj depot TP3 --- TP3/docu.md | 2 ++ TP3/service3.py | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 TP3/service3.py diff --git a/TP3/docu.md b/TP3/docu.md index d804955..69072dc 100644 --- a/TP3/docu.md +++ b/TP3/docu.md @@ -69,6 +69,8 @@ In askservice1 client - Can you see an advantage to use it? ### service3.py +Use of global variables + ##More interesting ### The shutdown problem When the server is running it uses a givent port on the machine and forbids another server to be run. diff --git a/TP3/service3.py b/TP3/service3.py new file mode 100644 index 0000000..55f46d4 --- /dev/null +++ b/TP3/service3.py @@ -0,0 +1,17 @@ + +from flask import Flask +from datetime import datetime + +compteur=0 +app = Flask(__name__) # notre appli + +@app.route('/service1') # service (service1) et la fonction associé +def dire_coucou(): + global compteur + compteur+=1 + myTime =datetime.today() + + txt=str(myTime.hour)+"h "+str(myTime.minute)+"min "+str( myTime.second)+"s" + return 'appel n° '+ str(compteur)+" "+txt +#http://127.0.0.1:5000/service1 # appel +app.run(debug=True) \ No newline at end of file -- GitLab