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


Download files

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

Source Distribution

bottle_pika-0.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bottle_pika-0.1.0-py2.7.egg (5.0 kB view details)

Uploaded Egg

File details

Details for the file bottle_pika-0.1.0.tar.gz.

File metadata

  • Download URL: bottle_pika-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bottle_pika-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4d55b23be8dc93dfdd843fbcff88cc6e059503b4a28a470e261b0a8f4dec3534
MD5 7b01c498d5b12ab7dbd152e8c2f66995
BLAKE2b-256 d85e324e1f1eb41c1efc78a6f9a1421f86ee2cb62f00c1e09809c8cd9dbac172

See more details on using hashes here.

File details

Details for the file bottle_pika-0.1.0-py2.7.egg.

File metadata

File hashes

Hashes for bottle_pika-0.1.0-py2.7.egg
Algorithm Hash digest
SHA256 fc2e5cf1375fadd33a532e1eb0f302a677f01baecdcdab38b74291316d412828
MD5 541278286d7b820656515bd2b88a6f97
BLAKE2b-256 eb3a314a71de9b28f0d13cdc7429a1e13fafd61c024d14192ff6f93bf689ec71

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page