summaryrefslogtreecommitdiff
path: root/venv/lib/python3.11/site-packages/websockets/http.py
blob: 9f86f6a1ffa6b229aefdf4c65453d2c3d37fd2f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from __future__ import annotations

import sys
import typing

from .imports import lazy_import
from .version import version as websockets_version


# For backwards compatibility:


# When type checking, import non-deprecated aliases eagerly. Else, import on demand.
if typing.TYPE_CHECKING:
    from .datastructures import Headers, MultipleValuesError  # noqa: F401
else:
    lazy_import(
        globals(),
        # Headers and MultipleValuesError used to be defined in this module.
        aliases={
            "Headers": ".datastructures",
            "MultipleValuesError": ".datastructures",
        },
        deprecated_aliases={
            "read_request": ".legacy.http",
            "read_response": ".legacy.http",
        },
    )


__all__ = ["USER_AGENT"]


PYTHON_VERSION = "{}.{}".format(*sys.version_info)
USER_AGENT = f"Python/{PYTHON_VERSION} websockets/{websockets_version}"