tacacs-plus
raw JSON → 2.6 verified Mon Apr 27 auth: no python
A client library for TACACS+ authentication. Provides both a low-level network client and a high-level authentication/authorization/accounting interface. Current version 2.6, maintained by the Ansible community. Release cadence is irregular.
pip install tacacs-plus Common errors
error tacacs_plus.client.TACACSClient.authenticate() got an unexpected keyword argument 'timeout' ↓
cause The 'timeout' argument was added in version 2.3; older versions do not accept it.
fix
Upgrade to version 2.3 or later: pip install --upgrade tacacs-plus
error AttributeError: module 'tacacs_plus' has no attribute 'TACACSClient' ↓
cause Wrong import path: users try to import TACACSClient directly from top-level module.
fix
Use correct import: from tacacs_plus.client import TACACSClient
error TypeError: a bytes-like object is required, not 'str' ↓
cause In Python 3, passing a string where bytes are expected (e.g., secret).
fix
Ensure secret is a string; if you must use bytes, encode it properly: secret=b'secret'.decode() or use str.
Warnings
breaking In version 2.0, the package name changed from 'tacacs' to 'tacacs-plus'. The import path also changed; you must now import from 'tacacs_plus'. ↓
fix Replace 'import tacacs' with 'from tacacs_plus import ...'.
gotcha The secret parameter is mandatory and must be a string, not bytes. Passing bytes results in a TypeError. ↓
fix Ensure secret is a str (e.g., secret='mysecret').
gotcha The timeout parameter is in seconds but may be ignored on some platforms (e.g., Windows) due to socket timeout limitations. ↓
fix Test timeout behavior on your target platform; use a small default (e.g., 5 seconds).
deprecated Python 2.7 support is deprecated and will be removed in a future release. ↓
fix Upgrade to Python 3.
Imports
- TACACSClient
from tacacs_plus.client import TACACSClient - Session
from tacacs_plus.session import Session - Flags
from tacacs_plus.flags import *
Quickstart
from tacacs_plus.client import TACACSClient
client = TACACSClient(
host='tacacs.example.com',
port=49,
secret='shared_secret',
timeout=5
)
authenticated = client.authenticate(
username='admin',
password='supersecret',
authen_type=1 # ASCII
)
print('Authenticated:', authenticated)