Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
FIFO message queue plugin for bottle.py based on HotQueue
bottle.py <http://bottlepy.org>
_ is a fast and simple micro-framework for python web-applications.
HotQueue <https://richardhenry.github.com/hotqueue/>
_ is a Python library that allows you to use Redis as a message queue within your Python programs.
::
$ pip install bottle-hotqueue
From source
::
$ python setup.py install
Dependencies
bottle
and hotqueue
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/
MIT
Github links
FAQs
FIFO Queue for Bottle built upon HotQueue
We found that bottle-hotqueue demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.