-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnorm_sender_web_main.py
55 lines (38 loc) · 1.11 KB
/
norm_sender_web_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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'''
'''
import os
if os.name=='nt':
os.add_dll_directory(os.path.dirname(__file__))
from fastapi_offline import FastAPIOffline
app = FastAPIOffline(
title = "Norm Send Test",
description ='''
Norm sender instace
'''
)
from fastapi import APIRouter
api_router = APIRouter()
from api_v1 import web_instance,session_send,session_common
api_router.include_router(web_instance.router, prefix="/instance", tags=["Instance"])
api_router.include_router(session_send.router, prefix="/session", tags=["SessionSend"])
api_router.include_router(session_common.router, prefix="/common", tags=["SessionCommon"])
app.include_router(api_router)
import deps
@app.on_event("startup")
async def on_startup() -> None:
'''
'''
deps.init_server()
@app.on_event("shutdown")
def on_shutdown() -> None:
'''
'''
if deps.task:
deps.task.cancel()
if __name__ == "__main__":
import sys
if len(sys.argv)<2:
print ("<cmd_name> <web_port>")
exit(1)
import uvicorn
uvicorn.run(app,host='0.0.0.0',port=int(sys.argv[1]),loop='asyncio')