python-glinet is a robust Python 3 library for interacting with
GL.iNet router's LuCI API on firmware 4.x and later. It enables
developers to programmatically manage and configure GL.iNet routers with
features like dynamic API method generation, object-oriented response
parsing, and automated session maintenance. Ideal for automation scripts
and integrations, it supports interactive exploration via IPython.
- Comprehensive API Coverage: Full access to LuCI API endpoints for firmware 4.x+.
 - Dynamic Methods: Auto-generates methods with docstrings from API documentation.
 - Intuitive Responses: Converts JSON responses to objects for dot-notation access.
 - Session Handling: Background thread for connection persistence; cached credentials.
 - Interactive Support: Optimized for IPython with code completion and docstrings.
 
Note
- Supports firmware 4.x+ only, following GL.iNet's JSON-RPC transition.
 - Uses archived API snapshot from Internet Archive .
 
Via pip (recommended in a virtual environment):
pip install python-glinetFrom source for development:
git clone https://github.com/tomtana/python-glinet.git
cd python-glinet
python3 -m venv venv
source venv/bin/activate
pip install -e .See Python's venv guide for details on virtual environments.
The GlInet class manages authentication and API interactions.
Customize defaults (e.g., IP, username) via constructor parameters.
Refer to class
docs.
from pyglinet import GlInet
glinet = GlInet().login()  # Instantiates and logs inWarning
Do not pass passwords in code; use persistence or prompts for security.
Note
- Loads API description from cache or online.
 - login() handles credentials and starts session keeper.
 
In IPython, after login:
api_client = glinet.get_api_client()- Structure: 
api_client.<group>.<method> - Naming: Hyphens replaced with underscores (e.g., 
wg_client). - Navigation: Use tab completion and 
?for docstrings. 
List groups:
api_clientExplore methods:
api_client.wg_clientView parameters:
api_client.wg_client.set_configDocstring:
api_client.wg_client.set_config?Call method:
api_client.wg_client.get_all_config_list()Responses are objects for easy access.
glinet.request("call", ["adguardhome", "get_config"])Equivalent to api_client.adguardhome.get_config(), but returns full
response.
- Dynamic docstrings
 - PyPI package
 - Tests and coverage
 - Windows compatibility
 - Cli wrapper
 
Welcome contributions! Fork, branch, and PR on GitHub. Test changes and follow roadmap.
For issues, use GitHub Issues.
MIT License. See LICENSE.
