{"id":2346,"library":"uamqp","title":"AMQP 1.0 Client Library for Python","description":"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.","status":"maintenance","version":"1.6.11","language":"python","source_language":"en","source_url":"https://github.com/Azure/azure-uamqp-python","tags":["amqp","azure","messaging","c-extension"],"install":[{"cmd":"pip install uamqp","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"Connection","correct":"from uamqp import Connection"},{"symbol":"Message","correct":"from uamqp import Message"},{"symbol":"SenderLink","correct":"from uamqp import SenderLink"},{"symbol":"ReceiverLink","correct":"from uamqp import ReceiverLink"},{"symbol":"authentication","correct":"from uamqp import authentication"}],"quickstart":{"code":"import os\nimport time\nimport uamqp\nfrom uamqp import authentication, Message, SenderLink, Connection\n\n# Set these environment variables for a runnable example:\n# AMQP_ADDRESS: e.g., \"amqps://<namespace>.servicebus.windows.net/<entity_name>\"\n# SAS_POLICY: e.g., \"RootManageSharedAccessKey\"\n# SAS_KEY: The shared access key for the policy\nAMQP_ADDRESS = os.environ.get(\"AMQP_ADDRESS\", \"amqps://localhost:5672/my_queue\")\nSAS_POLICY = os.environ.get(\"SAS_POLICY\", \"your_sas_policy_name\")\nSAS_KEY = os.environ.get(\"SAS_KEY\", \"your_sas_key\")\n\nconn = None\nsender = None\n\ntry:\n    if not all([AMQP_ADDRESS, SAS_POLICY, SAS_KEY]):\n        print(\"Please set AMQP_ADDRESS, SAS_POLICY, and SAS_KEY environment variables.\")\n        exit(1)\n\n    # Extract hostname (e.g., <namespace>.servicebus.windows.net) from AMQP_ADDRESS\n    hostname = AMQP_ADDRESS.split('//', 1)[-1].split('/', 1)[0].split(':', 1)[0]\n    # Extract target address (e.g., <entity_name>) from AMQP_ADDRESS\n    target_address = AMQP_ADDRESS.split('/', 3)[-1]\n\n    # Create SASL authentication\n    sasl_auth = authentication.SASLPlain(\n        hostname=hostname,\n        username=SAS_POLICY,\n        password=SAS_KEY\n    )\n\n    # Create an AMQP connection\n    print(f\"Connecting to {hostname}...\")\n    conn = Connection(\n        hostname,\n        sasl_auth=sasl_auth,\n        idle_timeout=10000,\n        debug=False # Set to True for verbose AMQP tracing\n    )\n\n    # Create a SenderLink to send messages\n    sender = SenderLink(conn, target_address, debug=False)\n    sender.open()\n    print(f\"SenderLink opened to {target_address}\")\n\n    # Create and send a message\n    message_body = f\"Hello from uAMQP at {time.time()}!\"\n    message = Message(message_body.encode('utf-8'))\n    sender.send_messages([message])\n    print(f\"Sent message: '{message_body}'\")\n\n    time.sleep(1) # Give time for message to be sent\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Ensure your environment variables are correctly configured and the AMQP endpoint is accessible.\")\nfinally:\n    if sender and sender.is_open:\n        sender.close()\n        print(\"SenderLink closed.\")\n    if conn and conn.is_open:\n        conn.close()\n        print(\"Connection closed.\")","lang":"python","description":"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."},"warnings":[{"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.","message":"The `uamqp` library is no longer in active development and has moved to a maintenance-only status.","severity":"deprecated","affected_versions":">=1.6.5"},{"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.","message":"As 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"Direct use of `uamqp` for Azure messaging services like Event Hubs or Service Bus is generally not recommended for most users.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'1.0':2,11 '1.6.11':41 'amqp':1,10,34,64,69 'around':23 'azur':25,53,70 'bus':58 'c':20,27,73 'c-extens':19,72 'client':3,12 'current':38 'develop':68 'event':55 'extens':21,74 'hub':56 'implement':36 'level':33 'librari':4,13,28,46,65 'low':32 'low-level':31 'mainten':49 'major':52 'messag':71 'mode':50 'new':67 'protocol':35 'provid':30 'pure':62 'python':6,15,63 'sdks':54 'serv':16 'servic':57 'uamqp':7,26 'util':60 'v1.6.5':44 'version':39 'wrapper':22","created_at":"2026-04-09T18:54:05.153690+00:00","updated_at":"2026-04-16T23:51:47.821598+00:00","problems":[{"fix":"Download and install \"Build Tools for Visual Studio\" from the provided URL, selecting the \"Desktop development with C++\" workload.","cause":"Installing `uamqp` on Windows requires the Microsoft C++ Build Tools to compile its C extension from source.","error":"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/"},{"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.","cause":"The `uamqp` C extension's dynamic link library (DLL) failed to load, often due to missing Visual C++ Redistributables or an incomplete build.","error":"ImportError: DLL load failed while importing _c_uamqp: The specified module could not be found."},{"fix":"Install the package using pip: `pip install uamqp`","cause":"The `uamqp` package has not been installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'uamqp'"},{"fix":"Verify the hostname, port, network connectivity, and firewall rules; ensure the AMQP broker is running and accessible.","cause":"The AMQP client failed to establish a connection to the broker due to network problems, an incorrect address, or an unavailable service.","error":"uamqp.errors.AMQPConnectionError: AMQPConnectionError: Cannot connect to [hostname]:[port] because of a timeout or connection issue."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.6.11","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/Azure/azure-uamqp-python","docs":null,"changelog":null,"pypi":"https://pypi.org/project/uamqp/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["azure","http-networking","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-28","next_check":"2026-07-28","install_tag":null}}