-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
43 lines (28 loc) · 862 Bytes
/
Copy pathmain.py
File metadata and controls
43 lines (28 loc) · 862 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
from contextlib import asynccontextmanager
from dotenv import load_dotenv
from fastapi import FastAPI
from customer.router import customer_router
from db import create_db_and_tables, run_auto_migrations
import redis
from config import init_settings
@asynccontextmanager
async def lifespan(app: FastAPI):
print("app startaup..")
await run_auto_migrations()
# app.redis_client = redis.from_url("redis://localhost")
init_settings({
"REDIS_CLIENT": redis.from_url("redis://localhost")
})
# asyncio.create_task(agent_message_handler(
# app.redis_client, app.AGENT_PHONE_ID
# ))
yield
booking_app = FastAPI(
lifespan=lifespan
)
@booking_app.get('/say_hello_to-{name}')
def fnc(name):
return {
"message": f"Helo {name}"
}
booking_app.include_router(customer_router, prefix="/customer")