Registry / azure / uamqp
library1.6.11pypypi✓ verified 23d ago

uAMQP is an AMQP 1.0 Client Library for Python, serving as a C-extension wrapper around the Azure uAMQP C library. It provides low-level AMQP protocol implementation. The current version is 1.6.11. As of v1.6.5, the library is in maintenance mode, with major Azure SDKs (Event Hubs, Service Bus) now utilizing a pure Python AMQP library for new development.

pip install uamqp
INSTALL
IMPORT
SIG · UAMQP
U
uamqp
azurepythonv1.6.11
Install
1.8s avg
Import
272ms
Disk
33MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.6.11 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.272s · 35MB
33MB installed
● package 33MB
Code
Verified usage

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

Connection
from uamqp import Connection
Message
from uamqp import Message
SenderLink
from uamqp import SenderLink
ReceiverLink
from uamqp import ReceiverLink
authentication
from uamqp import authentication

This quickstart demonstrates how to establish an AMQP connection, authenticate using SASLPlain, and send a message to a target entity (e.g., an Azure Service Bus queue or Event Hub). It assumes authentication details are provided via environment variables.

import os import time import uamqp from uamqp import authentication, Message, SenderLink, Connection # Set these environment variables for a runnable example: # AMQP_ADDRESS: e.g., "amqps://<namespace>.servicebus.windows.net/<entity_name>" # SAS_POLICY: e.g., "RootManageSharedAccessKey" # SAS_KEY: The shared access key for the policy AMQP_ADDRESS = os.environ.get("AMQP_ADDRESS", "amqps://localhost:5672/my_queue") SAS_POLICY = os.environ.get("SAS_POLICY", "your_sas_policy_name") SAS_KEY = os.environ.get("SAS_KEY", "your_sas_key") conn = None sender = None try: if not all([AMQP_ADDRESS, SAS_POLICY, SAS_KEY]): print("Please set AMQP_ADDRESS, SAS_POLICY, and SAS_KEY environment variables.") exit(1) # Extract hostname (e.g., <namespace>.servicebus.windows.net) from AMQP_ADDRESS hostname = AMQP_ADDRESS.split('//', 1)[-1].split('/', 1)[0].split(':', 1)[0] # Extract target address (e.g., <entity_name>) from AMQP_ADDRESS target_address = AMQP_ADDRESS.split('/', 3)[-1] # Create SASL authentication sasl_auth = authentication.SASLPlain( hostname=hostname, username=SAS_POLICY, password=SAS_KEY ) # Create an AMQP connection print(f"Connecting to {hostname}...") conn = Connection( hostname, sasl_auth=sasl_auth, idle_timeout=10000, debug=False # Set to True for verbose AMQP tracing ) # Create a SenderLink to send messages sender = SenderLink(conn, target_address, debug=False) sender.open() print(f"SenderLink opened to {target_address}") # Create and send a message message_body = f"Hello from uAMQP at {time.time()}!" message = Message(message_body.encode('utf-8')) sender.send_messages([message]) print(f"Sent message: '{message_body}'") time.sleep(1) # Give time for message to be sent except Exception as e: print(f"An error occurred: {e}") print("Ensure your environment variables are correctly configured and the AMQP endpoint is accessible.") finally: if sender and sender.is_open: sender.close() print("SenderLink closed.") if conn and conn.is_open: conn.close() print("Connection closed.")
Debug
Known issues
deprecatedThe `uamqp` library is no longer in active development and has moved to a maintenance-only status.
fix
For new Azure messaging development (Event Hubs, Service Bus), consider using the higher-level `azure-eventhub` or `azure-servicebus` libraries, which now use a pure Python AMQP implementation. `uamqp` will only receive critical bug and security fixes.
affects: >=1.6.5
gotchaAs a C-extension wrapper, `uamqp` requires C/C++ build tools and Python development headers for installation from source, or if pre-built wheels are not available for your platform/Python version.
fix
Ensure your system has the necessary build tools (e.g., `build-essential` on Linux, Visual Studio on Windows) and Python development packages installed. It also depends on OpenSSL, which might cause issues on some systems with specific versions.
affects: All versions
gotchaDirect use of `uamqp` for Azure messaging services like Event Hubs or Service Bus is generally not recommended for most users.
fix
The Azure SDKs for Python (`azure-eventhub`, `azure-servicebus`) provide a more idiomatic and higher-level API for interacting with these services. `uamqp` is a lower-level library primarily intended for internal SDK use or advanced AMQP scenarios.
affects: All versions
Errors
Common errors & fixes
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
Installing `uamqp` on Windows requires the Microsoft C++ Build Tools to compile its C extension from source.
fix
Download and install "Build Tools for Visual Studio" from the provided URL, selecting the "Desktop development with C++" workload.
ImportError: DLL load failed while importing _c_uamqp: The specified module could not be found.
The `uamqp` C extension's dynamic link library (DLL) failed to load, often due to missing Visual C++ Redistributables or an incomplete build.
fix
Install the appropriate Visual C++ Redistributable for your system (e.g., from microsoft.com), or try reinstalling `uamqp` after verifying C++ build tools are present.
ModuleNotFoundError: No module named 'uamqp'
The `uamqp` package has not been installed in the current Python environment.
fix
Install the package using pip: `pip install uamqp`
uamqp.errors.AMQPConnectionError: AMQPConnectionError: Cannot connect to [hostname]:[port] because of a timeout or connection issue.
The AMQP client failed to establish a connection to the broker due to network problems, an incorrect address, or an unavailable service.
fix
Verify the hostname, port, network connectivity, and firewall rules; ensure the AMQP broker is running and accessible.
Upgrade
Version history
1.6.11latest on PyPI · released Oct 28, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
34 hits · last 30 days
node
26
OpenAI (training)
1
Resources
uamqp — pip install uamqp · libregistry