-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.py
More file actions
45 lines (27 loc) · 848 Bytes
/
api.py
File metadata and controls
45 lines (27 loc) · 848 Bytes
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
import flask
import api_fun
from api_fun import apiLogic
app = flask.Flask(__name__)
app.config["DEBUG"] = True
@app.route('/', methods=['GET'])
def home():
return '''<h1>Hello</h1>'''
@app.route('/<title1>/')
def getAll(title1=None):
api_funob = apiLogic()
countryinfo =api_funob.gettingInfo(title1)
if countryinfo is not None:
return str(countryinfo)
else:
return 'ERROR NOT FOUUUUUND'
@app.route('/<title1>/info=<spec>/', methods=['GET'])
def getBySpec1(title1, spec):
api = apiLogic()
countryInfo = api.gettingInfo(title1)
return api.spec1(countryInfo,spec)
@app.route('/<title1>/info=<spec1>,<spec2>/', methods=['GET'])
def getBySpec2(title1, spec1, spec2):
api = apiLogic()
countryInfo = api.gettingInfo(title1)
return api.spec2(countryInfo,spec1,spec2)
app.run()