python-freeipa

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

A lightweight FreeIPA client library for Python. Provides Pythonic access to FreeIPA JSON-RPC API. Current version is 1.0.10, requires Python >=3.10. Release cadence is low (last release in 2023).

pip install python-freeipa
error freeipa.exceptions.FreeIPAError: 401 Unauthorized
cause Incorrect username or password, or server requires Kerberos authentication.
fix
Verify credentials. For Kerberos, ensure you have a valid TGT (kinit) and pass remote_user parameter instead.
error ImportError: cannot import name 'FreeIPA' from 'freeipa'
cause Using old import path which changed in version 1.0.0.
fix
Import from freeipa.client: from freeipa.client import FreeIPA
error requests.exceptions.ConnectionError: HTTPConnectionPool(host='ipa.example.com', port=443): Max retries exceeded
cause FreeIPA server is unreachable or SSL certificate mismatch.
fix
Check network connectivity, hostname, and SSL certificate. You can disable SSL verification with verify_ssl=False (insecure, not recommended).
breaking In version 1.0.0+, the import path changed from `freeipa` to `freeipa.client`. Old code using `from freeipa import FreeIPA` will break.
fix Use `from freeipa.client import FreeIPA`
gotcha The `user_find` and similar methods return a list of dicts, not a single object. Common mistake: treating the result as a single user.
fix Access the first element: `users = client.user_find('admin'); user = users[0] if users else None`
deprecated The `password` parameter in the constructor is deprecated since version 1.0.8. Use `password` as a keyword argument to the individual method calls instead.
fix Pass password when calling methods: `client.user_find('admin', password='secret')`

Initialize a FreeIPA client and perform a user search. Replace host, username, password with actual credentials.

from freeipa.client import FreeIPA

client = FreeIPA(
    host='ipa.example.com',
    username='admin',
    password='secret'
)
print(client.user_find('admin'))