Skip to content
Snippets Groups Projects
Commit 4872319c authored by ChevrierVincent's avatar ChevrierVincent
Browse files

maj depot TP3

parent f3702539
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment