找回密码
 立即注册
搜索
热搜: 丝袜 魅魔 黑丝
查看: 7|回复: 0

18145487_局长的私人检查!温柔护士的调教炼狱

[复制链接]

13万

主题

343

回帖

22万

积分

管理员

站长

UID
1
积分
224398
余额
13 R
Moe币
84879
在线时间
279 小时
注册时间
2025-12-28
最后登录
2026-11-6
发表于 2026-9-3 23:00:59 | 显示全部楼层 |阅读模式
from __future__ import annotations

import http
import ssl as ssl_module
import urllib.parse
from typing import Any, Awaitable, Callable, Literal

import trio

from ..http11 import Request, Response
from .server import Server, ServerConnection, serve


__all__ = ["route", "Router"]


try:
    from werkzeug.exceptions import NotFound
    from werkzeug.routing import Map, RequestRedirect

except ImportError:

    async def route(
        url_map: Map,
        *args: Any,
        server_name: str | None = None,
        ssl: ssl_module.SSLContext | Literal[True] | None = None,
        create_router: type[Router] | None = None,
        task_status: trio.TaskStatus[Server] = trio.TASK_STATUS_IGNORED,
        **kwargs: Any,
    ) -> None:
        raise ImportError("route() requires werkzeug")

else:

    async def route(
        url_map: Map,
        *args: Any,
        server_name: str | None = None,
        ssl: ssl_module.SSLContext | Literal[True] | None = None,
        create_router: type[Router] | None = None,
        task_status: trio.TaskStatus[Server] = trio.TASK_STATUS_IGNORED,
        **kwargs: Any,
    ) -> None:
        """
        Create a WebSocket server dispatching connections to different handlers.

        This feature requires the third-party library `werkzeug`_:

        .. code-block:: console

            $ pip install werkzeug

        .. _werkzeug: https://werkzeug.palletsprojects.com/

        :func:`route` accepts the same arguments as
        :func:`~websockets.trio.server.serve`, except as described below.

        The first argument is a :class:`werkzeug.routing.Map` that maps URL patterns
        to connection handlers. In addition to the connection, handlers receive
        parameters captured in the URL as keyword arguments.

        Here's an example::

            from websockets.trio.router import route
            from werkzeug.routing import Map, Rule

            async def channel_handler(websocket, c
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|M男之家

GMT+8, 2026-11-8 19:18 , Processed in 0.031178 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表