Azure Event Hubs SDK — Python
Package: azure-eventhub | README | Full Troubleshooting Guide
Common Errors
| Exception | Cause | Fix |
|---|---|---|
EventHubError | Base exception wrapping AMQP errors | Check message, error, details fields |
ConnectionLostError | Idle connection disconnected | Auto-recovers on next operation; no action needed |
AuthenticationError | Bad credentials or expired SAS | Regenerate key, check RBAC roles, verify connection string |
OperationTimeoutError | Network or throttling | Check firewall, try WebSockets (port 443), increase timeout |
Retry Configuration
Auth:
DefaultAzureCredentialis for local development. See auth-best-practices.md for production patterns.
python
from azure.eventhub import EventHubProducerClient
from azure.identity import DefaultAzureCredential
client = EventHubProducerClient(