-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.py
36 lines (23 loc) · 786 Bytes
/
main.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
from fastapi import FastAPI
from fastapi.responses import JSONResponse
from api import gati, ekart, dtdc, bluedart
app = FastAPI()
@app.get("/")
def main():
return {"message": "API is UP!"}
@app.get("/active")
def active():
return JSONResponse({"gati": True, "ekart": True, "dtdc": True, "bluedart": True})
@app.get("/gati")
@app.get("/gati/{dktno}")
def _gati(dktno: str):
return JSONResponse(gati.get_data(dktno))
@app.get("/ekart/{trackingId}")
def _ekart(trackingId: str):
return JSONResponse(ekart.get_data(trackingId))
@app.get("/dtdc/{trackingId}")
def _dtdc(trackingId: str):
return JSONResponse(dtdc.get_data(trackingId))
@app.get("/bluedart/{trackingId}")
def _bluedart(trackingId: str):
return JSONResponse(bluedart.get_data(trackingId))