INNER CODE UNIT · Python

lifespan

tombcato/clash-ip-checker · web.py:21

async def lifespan(app: FastAPI):
    # Startup
    yield
    # Shutdown
    print("[Web] Shutting down, cleaning up resources...")
    await state.checker.stop()

app = FastAPI(title="Clash IP Checker", lifespan=lifespan)

# Mount supporting static files
static_dir = os.path.join(os.path.dirname(__file__), "static")
if os.path.exists(static_dir):
    app.mount("/static", StaticFiles(directory=static_dir), name="static")

# Ensure exports directory
exports_dir = "exports"
os.makedirs(exports_dir, exist_ok=True)
app.mount("/exports", StaticFiles(directory=exports_dir), name="exports")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…