INNER CODE UNIT · Python
lifespan
eidolon-ai/eidolon · browser-service/eidolon_browser_service/main.py:21
async def lifespan(app):
await browser_service.start()
yield
await browser_service.stop()
app = FastAPI(lifespan=lifespan)
@app.get("/", include_in_schema=False)
async def docs_redirect():
return RedirectResponse(url="/docs")
@app.post("/contexts/{context_id}/pages")
async def create_page(context_id: str):
context = await browser_service.get_or_create_context(context_id)
page = await context.create_page()