Skip to main content

GitHub Workflow Status (event) GitHub Workflow Status PyPI - Python Version PyPI Code Cov

python-glinet: Python 3 Client for GL.iNet Routers

Introduction

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.

python-glinet demonstration

Features

  • 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 .

Installation

Via pip (recommended in a virtual environment):

pip install python-glinet

From 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.

Quick Start

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 in

[!WARNING] 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.

API Usage

Dynamic Client

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.

Examples

List groups:

api_client

Explore methods:

api_client.wg_client

View parameters:

api_client.wg_client.set_config

Docstring:

api_client.wg_client.set_config?

Call method:

api_client.wg_client.get_all_config_list()

Responses are objects for easy access.

Direct Requests

glinet.request("call", ["adguardhome", "get_config"])

Equivalent to api_client.adguardhome.get_config(), but returns full response.

Roadmap

  • [x] Dynamic docstrings
  • [x] PyPI package
  • [x] Tests and coverage
  • [x] Windows compatibility
  • [ ] Cli wrapper

Contributing

Welcome contributions! Fork, branch, and PR on GitHub. Test changes and follow roadmap.

For issues, use GitHub Issues.

License

MIT License. See LICENSE.

Release files for python-glinet 0.8.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-glinet 0.8.2
File Size Uploaded
python_glinet-0.8.2.tar.gz 130.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-glinet 0.8.2
File Interpreter ABI Platform
python_glinet-0.8.2-py3-none-any.whl Python 3 none any Details

Total release size: 252.6 kB

Release files / python_glinet-0.8.2.tar.gz

Download URL python_glinet-0.8.2.tar.gz
Size 130.1 kB
Tags Source
SHA-256 checksum
How to use checksums
244d5b7925a207751e1655af74ebd3a819215e9e2ab9d28850f378b8a0c22c26
BLAKE2b-256 checksum
How to use checksums
24f2fc20fcc03ed76d9855d773fc693de88d7304d924dfab4424daa6f35d8116
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.24

Release files / python_glinet-0.8.2-py3-none-any.whl

Download URL python_glinet-0.8.2-py3-none-any.whl
Size 122.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0db58753c7ab306fa9c9770e71c8ec635f4d476320117f6e1fee16b6e84f9678
BLAKE2b-256 checksum
How to use checksums
18bf814ca423ebb7fcbd541bca4396edcbd97ec6bf3595e61ce3c2fde56513f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.24

Release history Release notifications | RSS feed

This release

0.8.2 This release

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.15

2 release files

0.3.14

1 release file

0.3.13

2 release files

0.3.9

1 release file

0.3.8

1 release file

0.3.7

1 release file

0.3.6

1 release file

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page