Skip to content

(websockets 12.0) DeprecationWarning: websockets.connection was renamed to websockets.protocol and Connection was renamed to Protocol #2873

@Gerhut

Description

@Gerhut

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

The DeprecationWarning is thrown here:

try: # websockets < 11.0
from websockets.connection import State
from websockets.server import ServerConnection as ServerProtocol
except ImportError: # websockets >= 11.0
from websockets.protocol import State # type: ignore
from websockets.server import ServerProtocol # type: ignore

With websockets 12 the try block would run successfully with the warning while the catch block does not have chance to be run.

Code snippet

No response

Expected Behavior

The catch block is being run instead.

How do you run Sanic?

Sanic CLI

Operating System

MacOS

Sanic Version

Sanic 23.6.0; Routing 23.6.0

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions