bottlehotqueue
FIFO message queue plugin for bottle.py based on HotQueue
bottle.py is a fast and simple micro-framework for python web-applications.
HotQueue is a Python library that allows you to use Redis as a message queue within your Python programs.
Installation
$ pip install bottle-hotqueue
From source
$ python setup.py install
Dependencies
bottle and hotqueue
Getting Started
Importing and using the plugin in Bottle
import bottle
from bottlehotqueue import Plugin
app = bottle.Bottle()
hotqueue = Plugin(keyword="myhotqueue")
app.install(hotqueue)
@app.post('/put/:value', myhotqueue={'queue': 'myqueue'})
def send_message(value, myqueue):
""" This will put an item in the queue hotqueue:myqueue.
"""
return myqueue.put(value)
@app.get('/get/', myhotqueue={'queue': 'myqueue'})
def get_message(myqueue):
""" We will now try to get a item from hotqueue:myqueue.
if the queue is empty, we instead raise a 404.
"""
result = myqueue.get()
if not result:
raise bottle.HTTPError(404, "Queue is Empty")
return result
bottle.run(app, host='', port=8080)
The plugin will use json (or simplejson if available) as the standard serializer. This behaviour can be reverted to match the default implementation by passing asjson=False when instantiating the plugin. It will then conform to the standard HotQueue way of serializing objects by using pickle (or cpickle if available).
hotqueue = Plugin(keyword="myhotqueue", asjson=False)
Writing a simple consumer
import json
from hotqueue import HotQueue
queue = HotQueue("myqueue", host="localhost", serializer=json)
for item in queue.consume():
print item
More on HotQueue: http://richardhenry.github.com/hotqueue/
License
MIT
Metadata
Release files for bottle-hotqueue 0.2.5
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 |
|---|---|---|---|---|
| bottle-hotqueue-0.2.5.tar.gz | 2.7 kB | Without provenance | Details for bottle-hotqueue-0.2.5.tar.gz |
Release files / bottle-hotqueue-0.2.5.tar.gz
| Download URL | bottle-hotqueue-0.2.5.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acdf87e15a61cd6f3eab63eb3cdf0ffafd081509dae34c717f5b47890823ad70
|
|
BLAKE2b-256 checksum How to use checksums |
ca43e469b26fa16096fdc0bbf515ec957c000d28c143af3597f1942f1fb2cf97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for bottle-hotqueue 0.2.5
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.