anypubsub
A generic interface wrapping multiple backends to provide a consistent pubsub API.
Usage
Create a pubsub object:
from anypubsub import create_pubsub
pubsub = create_pubsub('redis')
or create a pubsub object from settings:
from anypubsub import create_pubsub_from_settings
pubsub = create_pubsub_from_settings({'anypubsub.backend': 'redis'}, prefix='anypubsub.')
Subscribe to a channel:
subscriber = pubsub.subscribe('a_channel')
you can also subscribe to multiple channels:
subscriber = pubsub.subscribe('a_channel', 'b_channel')
the subscriber is an iterator object that returns the next published message at each loop increment, and blocks until next message is published.
Publish a message to a channel:
pubsub.publish('a_channel', 'hello world!')
message = next(subscriber)
assert message == 'hello world!'
Supported backends
redis
mongodb
Metadata
Release files for anypubsub 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| anypubsub-0.1.tar.gz | 4.5 kB | Without provenance | Details for anypubsub-0.1.tar.gz |
Release files / anypubsub-0.1.tar.gz
| Download URL | anypubsub-0.1.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5be378ffd016f0b5df8eda10a1b24f1bbe10d523d6dc415f8b098ec5f4b2755e
|
|
BLAKE2b-256 checksum How to use checksums |
0845b589bff9761f264a6a5321d38510db81809aa2b1cab5af2a1a848f22fc9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for anypubsub 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.