Skip to main content

Pika plugin module for Bottle microframework

Project description

Bottle-Pika is a plugin that integrates Pika (AMQP) with your Bottle application. It automatically connects to AMQP at the beginning of a request, passes the channel to the route callback and closes the connection and channel afterwards.

To automatically detect routes that need a channel, the plugin searches for route callbacks that require a mq keyword argument (configurable) and skips routes that do not. This removes any overhead for routes that don’t need a message queue.

This plugin was originally based on the bottle-mysql plugin found at:
https://pypi.python.org/pypi/bottle-mysql

Usage Example:

import bottle
import bottle_pika
import pika

app = bottle.Bottle()
pika_plugin = bottle_pika.Plugin(pika.URLParameters('amqp://localhost/'))
app.install(pika_plugin)

@app.route('/hello')
def hello(mq):
    mq.basic_publish(...)
    return HTTPResponse(status=200)
See pika documentation on channels for more information:
http://pika.readthedocs.org/en/latest/modules/channel.html#pika.channel.Channel

Project details


Release history Release notifications

This version
History Node

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
bottle_pika-0.1.0-py2.7.egg (5.0 kB) Copy SHA256 hash SHA256 Egg 2.7
bottle_pika-0.1.0.tar.gz (2.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page