-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathapp4.py
More file actions
46 lines (35 loc) · 1.16 KB
/
Copy pathapp4.py
File metadata and controls
46 lines (35 loc) · 1.16 KB
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
39
40
41
42
43
44
45
46
# import packages
from flask import Flask
# create app
app = Flask(__name__)
# start api development
@app.route("/")
def hello() -> str:
return "Hello World"
# develop api
@app.route("/ishita")
def welcome():
return "Hello Ishita, what is your order"
# develop api
@app.route("/<name>")
def greeting(name):
return 'Hello,' + name + ' what is your order and where do you want to eat it and how do you want to pay'
# develop api
@app.route("/<name>/<city>")
def my_client(name, city):
return "hello, sir " + name + "when did you come from " + city
# develop api
@app.route('/sale/<transaction_id>')
def get_sale(transaction_id = 0):
return 'The trasaction is ' + str(transaction_id)
# develop api
@app.route('/person/<name>/<father>/<mother>/<school>/<section>')
def about_person(name, father, mother, school, section):
print('Name: ' + name)
print('Father: ' + father)
print('Mother: ' + mother)
print('School: ' + school)
print('Section: ' + section)
return ({"name": name, "father": father, "mother": mother, "school": school, "section": section})
if __name__ == "__main__":
app.run(host="127.0.0.1", port=8084, debug=False)