Mistral Client Library
raw JSON → 6.2.0 verified Fri May 01 auth: no python
A Python client for OpenStack Mistral workflow service. Version 6.2.0, actively maintained. Releases follow OpenStack releases.
pip install python-mistralclient Common errors
error mistralclient.api.client module not found ↓
cause Installed older version (<2.0) where package structure was different.
fix
Upgrade to latest version:
pip install --upgrade python-mistralclient error AttributeError: module 'mistralclient' has no attribute 'api' ↓
cause Trying to import mistralclient directly instead of mistralclient.api.
fix
Use
from mistralclient.api import client Warnings
breaking From version 4.0.0, the authentication interface changed. The old `client.client(...)` no longer accepts positional arguments for auth parameters; all must be passed as keyword arguments. ↓
fix Always use keyword arguments when creating the client: `client.client(mistral_url=..., username=...)`.
gotcha The `client.client()` factory function returns an instance of `MistralClient`, but the class is also importable directly. However, using the factory is recommended because it handles version discovery and auth setup. ↓
fix Use `from mistralclient.api import client` and then `c = client.client(...)`.
deprecated Support for Python 2.7 was dropped in version 4.0.0. Also, Python 3.6 support ended in 5.0.0. ↓
fix Use Python 3.10 or newer (as of 6.2.0).
Imports
- client wrong
import mistralclientcorrectfrom mistralclient.api import client - MistralClient
from mistralclient.api.client import MistralClient
Quickstart
from mistralclient.api import client
mistral = client.client(mistral_url='http://localhost:8989/v2', username='admin', password='pass', project_name='admin', auth_url='http://localhost:5000/v3')
workflows = mistral.workflows.list()
print(workflows)