跳转至

server

feishu.gateway.server

create_app_from_env

Python
create_app_from_env(environ: Mapping[str, str] | None = None, *, configure: GatewayConfigure | None = None, client: Any | None = None) -> Starlette

Create the generic Feishu gateway app from environment variables.

源代码位于: feishu/gateway/server.py
Python
def create_app_from_env(
    environ: Mapping[str, str] | None = None,
    *,
    configure: GatewayConfigure | None = None,
    client: Any | None = None,
) -> Starlette:
    r"""Create the generic Feishu gateway app from environment variables."""
    return create_gateway(GatewayConfig.from_env(environ), configure=configure, client=client)

run_gateway

Python
run_gateway(environ: Mapping[str, str] | None = None, *, configure: GatewayConfigure | None = None, client: Any | None = None, runner: GatewayRunner | None = None) -> None

Run the generic Feishu gateway with uvicorn.

源代码位于: feishu/gateway/server.py
Python
def run_gateway(
    environ: Mapping[str, str] | None = None,
    *,
    configure: GatewayConfigure | None = None,
    client: Any | None = None,
    runner: GatewayRunner | None = None,
) -> None:
    r"""Run the generic Feishu gateway with uvicorn."""
    config = GatewayConfig.from_env(environ)
    app = create_gateway(config, configure=configure, client=client)
    if runner is None:
        import uvicorn

        runner = uvicorn.run
    runner(app, host=config.host, port=config.port)

main

Python
main() -> None

Console entrypoint for feishu-gateway.

源代码位于: feishu/gateway/server.py
Python
def main() -> None:
    r"""Console entrypoint for ``feishu-gateway``."""
    run_gateway()