TQP
An opinionated library for pub/sub over SQS and SNS
Topic
To publish on a topic:
topic = Topic('widgets--created')
topic.publish({'id': '123456'})
Topic Queue Poller
To read from the topic:
poller = TopicQueuePoller('my_poller')
@poller.handler('widgets--created')
def process_created_widget(item):
widget_id = item['id']
print(f'Widget {widget_id} was created')
poller.start()
S3 notifications
It is also possible to poll for s3 object notifications
@poller.s3_handler('my-bucket-name')
def process_file_created(msg):
print(msg)
# {
# 'event_name': 'ObjectCreated:Put',
# 'bucket_name': 'bespin-dev-consular21d51f71-11lpitfowdylc',
# 'object': {
# 'key': 'genome.fasta',
# 'size': 124,
# 'eTag': '5d9d04cd0b9d3b314d9bd622da06ab74',
# 'sequencer': '005FAD55883A198E97'
# },
# }
Flask
A Flask binding is also provided:
poller = FlaskTopicQueuePoller('my_poller', app=flask_app)
When using the Flask poller, you can also specify how to format the logs:
# the argument (optional) is a function that takes the message payload as input and return a message identifier
poller.set_log_formatter(lambda payload: payload["message"].get("id", "<NO ID>"))
Logstash
https://github.com/jquense/logstash-input-tqp
Provides a TQP poller as an LogStash input plugin.
Metadata
Release files for tqp 1.0.0
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 |
|---|---|---|---|---|
| tqp-1.0.0.tar.gz | 9.5 kB | Without provenance | Details for tqp-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tqp-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for tqp-1.0.0-py3-none-any.whl |
Total release size: 20.0 kB
Release files / tqp-1.0.0.tar.gz
| Download URL | tqp-1.0.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f4d571a1be0a28fd24c6a5703334671c2c782ad135ef4d7856d48a5f439dce2b
|
|
BLAKE2b-256 checksum How to use checksums |
d88d9afd5b95f8c2e9cda5f5b70c7bd66a2ac84b9856dc825779cad718d79212
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.18
|
Release files / tqp-1.0.0-py3-none-any.whl
| Download URL | tqp-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
211dfb71e735896de91a3bd290d124f9708566aa5340ec6b76f94c7549b70a8c
|
|
BLAKE2b-256 checksum How to use checksums |
0482ec5c14faba3c6d886c46726ed830f734dc5a2acd864bc605576718fd3823
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.18
|
Security for tqp 1.0.0
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.