-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepone.py
38 lines (30 loc) · 873 Bytes
/
repone.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# ---- Flask Hello World ---- #
# import the Flask class from the flask module
from flask import Flask
# create the application object
app = Flask(__name__)
# error handling
app.config["DEBUG"] = True
# use decorators to link the function to a url
@app.route("/")
@app.route("/hello")
# define the view using a function, which returns a string
def hello_world():
return "Hello, World!??????"
@app.route("/test/<search_query>")
def search(search_query):
return search_query
# dynamic route that accepts slashes
@app.route("/path/<path:value>")
def path_type(value):
print value
return "correct"
@app.route("/name/<name>")
def index(name):
if name.lower() == "michael":
return "Hello, {}".format(name)
else:
return "Not Found", 404
# start the development server using the run() method
if __name__ == "__main__":
app.run()