File: _install_only_enabled_handler_async.py

package info (click to toggle)
nc-py-api 0.19.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,320 kB
  • sloc: python: 12,415; makefile: 238; xml: 100; javascript: 56; sh: 14
file content (22 lines) | stat: -rw-r--r-- 472 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from contextlib import asynccontextmanager

from fastapi import FastAPI

from nc_py_api import AsyncNextcloudApp, ex_app


@asynccontextmanager
async def lifespan(_app: FastAPI):
    ex_app.set_handlers(APP, enabled_handler)
    yield


APP = FastAPI(lifespan=lifespan)


async def enabled_handler(_enabled: bool, _nc: AsyncNextcloudApp) -> str:
    return ""


if __name__ == "__main__":
    ex_app.run_app("_install_only_enabled_handler_async:APP", log_level="warning")