python-zaqarclient (OpenStack Zaqar Client)

raw JSON →
4.4.0 verified Fri May 01 auth: no python

python-zaqarclient is the official client library for the OpenStack Zaqar Messaging API (queuing and notification service). The current version is 4.4.0, requiring Python >=3.10. This library implements version 2 of the Zaqar API. Release cadence follows OpenStack coordinated releases.

pip install python-zaqarclient
error ModuleNotFoundError: No module named 'zaqarclient'
cause Package not installed or imported incorrectly.
fix
Run 'pip install python-zaqarclient' and ensure import uses 'from zaqarclient.client import ZaqarClient'.
error TypeError: __init__() missing 2 required positional arguments: 'endpoint' and 'conf'
cause Missing required arguments when creating ZaqarClient.
fix
Provide the endpoint URL and configuration dict: client = ZaqarClient(endpoint, version=2, conf=config)
error zaqarclient.transport.errors.TransportError: Expected HTTP 201 but received 401
cause Authentication failure due to wrong credentials or misconfigured auth options.
fix
Verify environment variables for OS_AUTH_URL, OS_USERNAME, etc., and check that the auth plugin is 'password'.
gotcha The client automatically uses version 1 of the API if the 'version' parameter is not specified. Always explicitly set version=2 to use the current API.
fix Pass version=2 when instantiating ZaqarClient or Client.
deprecated The 'claims' API and 'subscriptions' API are deprecated and will be removed in a future release. Use the equivalents from Zaqar 2.0 API (e.g., queue.subscriptions() instead of client.subscriptions()).
fix Migrate to queue-level methods for subscriptions and claims.
breaking Python 3.10 or newer is required. The library no longer supports Python 2.7 or Python 3.6.
fix Upgrade to Python 3.10+.

Connects to a Zaqar endpoint using OpenStack password authentication and creates a queue.

import os
from zaqarclient.client import ZaqarClient

# Configuration for authentication
conf = {
    'auth_opts': {
        'options': {
            'os_auth_url': os.environ.get('OS_AUTH_URL', ''),
            'os_username': os.environ.get('OS_USERNAME', ''),
            'os_password': os.environ.get('OS_PASSWORD', ''),
            'os_project_name': os.environ.get('OS_PROJECT_NAME', ''),
        },
        'auth_plugin': 'password',
    },
}

# Connect to Zaqar endpoint
zaqar_endpoint = os.environ.get('ZAQAR_ENDPOINT', '')
client = ZaqarClient(zaqar_endpoint, version=2, conf=conf)

# Create a queue
queue = client.queue('example-queue', auto_create=True)
print(f"Queue created: {queue.name}")