UTF Queue Client
raw JSON → 1.21.6 verified Fri May 01 auth: no python
A Python client for interacting with UTF (Unified Task Framework) queues. Version 1.21.6, actively maintained. Provides async and sync interfaces for queue operations like produce, consume, and manage messages. Releases occur frequently.
pip install utf-queue-client Common errors
error ModuleNotFoundError: No module named 'utf_queue_client' ↓
cause Trying to import with hyphens instead of underscores.
fix
Install the library: pip install utf-queue-client, then import: from utf_queue_client import UTFQueueClient
error TypeError: object of type 'NoneType' has no len() ↓
cause Pop from empty queue with default settings returns None, but code expects a dict or string.
fix
Check if msg is None before processing: msg = client.pop('queue'); if msg is None: continue
error ConnectionRefusedError: [Errno 111] Connection refused ↓
cause Endpoint is incorrect or service not running.
fix
Verify UTF_ENDPOINT environment variable or endpoint argument points to a running UTF server.
Warnings
breaking In version 1.20+, the default serialization changed from pickle to JSON. If you previously used pickle with complex objects, you must now implement custom serializers. ↓
fix Set serializer='pickle' explicitly when creating client to restore old behavior, or adapt data to be JSON-serializable.
deprecated The 'token' parameter is deprecated in favor of 'api_key' as of v1.19. The 'token' parameter still works but will be removed in v2.0. ↓
fix Use `api_key=...` instead of `token=...`.
gotcha When using async client, you must call `await client.connect()` explicitly before operations. Many users skip this and get 'Connection not established' errors. ↓
fix Always await client.connect() after instantiation before push/pop.
Imports
- UTFQueueClient
from utf_queue_client import UTFQueueClient - AsyncUTFQueueClient
from utf_queue_client import AsyncUTFQueueClient
Quickstart
import os
from utf_queue_client import UTFQueueClient
client = UTFQueueClient(
endpoint=os.environ.get('UTF_ENDPOINT', 'http://localhost:8080'),
token=os.environ.get('UTF_TOKEN', '')
)
# Push a message
client.push('my-queue', {'data': 'hello'})
# Pop a message
msg = client.pop('my-queue')
print(msg)