Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions mangum/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
except ImportError: # pragma: no cover
httpx = None # type: ignore

import boto3
from botocore.auth import SigV4Auth
from botocore.awsrequest import AWSRequest
try:
import boto3
from botocore.auth import SigV4Auth
from botocore.awsrequest import AWSRequest
except ImportError: # pragma: no cover
boto3 = None # type: ignore


from .base import WebSocketBackend
from ..exceptions import WebSocketError, ConfigurationError
Expand Down Expand Up @@ -49,6 +53,9 @@ class WebSocket:
api_gateway_region_name: Optional[str] = None

def __post_init__(self, dsn: Optional[str]) -> None:
if boto3 is None: # pragma: no cover
raise WebSocketError("boto3 must be installed to use WebSockets.")

if httpx is None: # pragma: no cover
raise WebSocketError("httpx must be installed to use WebSockets.")

Expand Down