diff --git a/TP3/docu.md b/TP3/docu.md index d80495546365b340b38b46ec0aaee72c55c5585d..69072dc5a592a943f918499cb55f398b00f8dcd3 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 0000000000000000000000000000000000000000..55f46d474a3f25e81af71bfbc25ea43418f08321 --- /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