Registry / http-networking / gh-rabbit-hole

gh-rabbit-hole

JSON →
library1.6.0pypypiunverified

A Python library for simplified communication with RabbitMQ, providing a high-level wrapper around pika. Current version is 1.6.0, compatible with Python >=3.10. Release cadence is irregular; maintained by m-ghiani.

pip install gh-rabbit-hole
INSTALL
IMPORT
SIG · GH-RABBIT-HOLE
G
gh-rabbit-hole
http-networkingpythonv1.6.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RabbitHole
from rabbithole import RabbitHole
from rabbit_hole import RabbitHole

Connect to RabbitMQ, declare a queue, publish and consume a message.

import os from rabbit_hole import RabbitHole # Initialize with environment variables or direct connection params rh = RabbitHole( host=os.environ.get('RABBIT_HOST', 'localhost'), port=int(os.environ.get('RABBIT_PORT', 5672)), username=os.environ.get('RABBIT_USER', 'guest'), password=os.environ.get('RABBIT_PASS', 'guest') ) # Declare a queue rh.declare_queue('test_queue') # Publish a message rh.publish('test_queue', {'message': 'hello world'}) # Consume messages (callback) def callback(ch, method, properties, body): print(f"Received: {body}") rh.ack(method.delivery_tag) rh.consume('test_queue', callback=callback, auto_ack=False) # Close connection rh.close()
Debug
Known issues
breakingIn version 1.0.0, the library was renamed from 'gh-rabbit-hole' to 'rabbit_hole' for imports. The package name on PyPI remains 'gh-rabbit-hole'.
fix
Use 'from rabbit_hole import RabbitHole' instead of any old import path.
affects: <1.0.0 and >=1.0.0
deprecatedThe method 'consume' without auto_ack parameter defaults to False, but future versions may change default to True. Explicitly pass auto_ack to avoid breakage.
fix
Always specify auto_ack=True or False explicitly when calling consume.
affects: 1.x
gotchaIf RabbitMQ is not running or connection fails, the library may hang indefinitely due to default timeout settings.
fix
Set timeout parameter explicitly, e.g., RabbitHole(..., timeout=5).
affects: all
gotchaThe 'publish' method expects a dict or string; passing other types may cause serialization errors.
fix
Ensure payload is a JSON-serializable dict or a string.
affects: all
Upgrade
Version history
1.6.0latest on PyPI · released Jan 1, 2024
Audit
Dependencies
pikarequiredCore dependency for RabbitMQ protocol
Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources
gh-rabbit-hole — pip install gh-rabbit-hole · libregistry