Some extensions for Django Channels.
Project description
channels-extensions
Installation
pip install channels-extensions
Usage
DummyChannelLayer
DummyChannelLayer is an noop (almost) implementation of BaseChannelLayer. Messages sent to it are never available, and receive never returns.
All methods work as checkpoints to the event loop, yielding control back to it at least once.
CHANNEL_LAYERS = {
"dummy": {
"BACKEND": "channels_extensions.layers.DummyChannelLayer",
}
}
get_channel_layer
This is simply a version of channels get_channel_layer, but it raises an ImproperlyConfigured if the alias does not exist.
CurrentSiteMiddleware
A middleware that mimics django's CurrentSiteMiddleware. It adds a site key to the scope:
class EchoSiteConsumer(AsyncConsumer):
async def websocket_connect(self, event):
await self.send({
"type": "websocket.accept",
})
async def websocket_receive(self, event):
await self.send({
"type": "websocket.send",
"text": self.scope["site"],
})
application = ProtocolTypeRouter({
"websocket": AllowedHostsOriginValidator(
AuthMiddlewareStack(
CurrentSiteMiddleware(
URLRouter([
path("echo/", EchoSiteConsumer.as_asgi()),
])
)
)
),
})
License
channels-extensions is distributed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file channels_extensions-0.0.1a1.tar.gz.
File metadata
- Download URL: channels_extensions-0.0.1a1.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9980b763b420c9d1ef210b8426247d923fe8c5380989f2e7b28b7257831cc428
|
|
| MD5 |
22f1e2614a98493f1e0b7747a6e738f6
|
|
| BLAKE2b-256 |
56ba0a331d55514008b5b868e5d4ec3a272ac2ee405e0de0bc83ef2bdce8ff75
|
Provenance
The following attestation bundles were made for channels_extensions-0.0.1a1.tar.gz:
Publisher:
release.yml on hartungstenio/channels-extensions
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
channels_extensions-0.0.1a1.tar.gz -
Subject digest:
9980b763b420c9d1ef210b8426247d923fe8c5380989f2e7b28b7257831cc428 - Sigstore transparency entry: 788879570
- Sigstore integration time:
-
Permalink:
hartungstenio/channels-extensions@67bd0a17ffc3f0b90abce12cffcaf6c4e0d2af55 -
Branch / Tag:
refs/tags/0.0.1a1 - Owner: https://github.com/hartungstenio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@67bd0a17ffc3f0b90abce12cffcaf6c4e0d2af55 -
Trigger Event:
release
-
Statement type:
File details
Details for the file channels_extensions-0.0.1a1-py3-none-any.whl.
File metadata
- Download URL: channels_extensions-0.0.1a1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9eda9f64858000cfc636b21066aa8a110749a05f2ff77acdabc15cf20f22e95
|
|
| MD5 |
ec5bc3ac30b5c2affce5293fe37b7b32
|
|
| BLAKE2b-256 |
5406b8a6d5ce24cfbc68d3e3a363f7cf2c780e9ed36e8ecf3c3815b5bcf68aef
|
Provenance
The following attestation bundles were made for channels_extensions-0.0.1a1-py3-none-any.whl:
Publisher:
release.yml on hartungstenio/channels-extensions
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
channels_extensions-0.0.1a1-py3-none-any.whl -
Subject digest:
d9eda9f64858000cfc636b21066aa8a110749a05f2ff77acdabc15cf20f22e95 - Sigstore transparency entry: 788879573
- Sigstore integration time:
-
Permalink:
hartungstenio/channels-extensions@67bd0a17ffc3f0b90abce12cffcaf6c4e0d2af55 -
Branch / Tag:
refs/tags/0.0.1a1 - Owner: https://github.com/hartungstenio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@67bd0a17ffc3f0b90abce12cffcaf6c4e0d2af55 -
Trigger Event:
release
-
Statement type: