A Python 3 async API wrapper for GL.iNet routers (firmware 4.x JSON-RPC API)
Project description
glinet4
An async Python 3 API wrapper for GL.iNet routers running version 4.x firmware.
GL.iNet routers are built on OpenWRT and expose a local JSON-RPC API. glinet4 wraps that API for easy integration into other services such as Home Assistant.
glinet4began as a fork of HarvsG/gli4py (GPL-3.0) and has since grown a much larger API surface. See NOTICE for attribution.
Installation
pip install glinet4
Dev setup
- Clone the repo
- Ensure you have Python 3.11 or greater (
python3 -V) and install uv. uv sync— creates the in-project.venvand installs the runtime + dev dependencies.- The tests run against a live router, so copy
.env.exampleto.envand set at leastGLINET_PASSWORD(andGLINET_HOSTif not192.168.8.1). Without it the live suite is skipped. uv run pytest -sto see responses.- Build with
uv build. Releases publish to PyPI automatically on a GitHub Release (trusted publishing).
Dev setup alongside HA & the Custom component
- Clone the repo into the vscode
/workspaces/dir - The inside the
ha-envterminal run(ha-venv) vscode ➜ /workspaces/core (branch-name) $ pip install -e /workspaces/gli4py - Ensure the custom component has
"python.analysis.extraPaths": ["/workspaces/glinet4/"]in.vscode/settings.json - deactivate the
ha-envwithdeactivate - Do steps 3 onwards above
API coverage
Session: login, router_reachable. All other methods require login first.
| Area | Methods |
|---|---|
| System | router_info, router_get_status, router_get_load, router_mac, router_reboot, router_unixtime, router_disk_info, router_usb_info, router_timezone_config |
| Network / WAN | wan_status, wan_cable_state, wan_info, ethernet_ports_status, network_mode, network_interfaces_status, connected_to_internet, ping |
| Clients | list_all_clients, list_static_clients, connected_clients, clients_status, clients_speed, wan_speed |
| WiFi | wifi_ifaces_get, wifi_iface_set_enabled, wifi_status, wifi_mlo_config |
| Firmware | firmware_check_online, upgrade_config |
| Firewall | firewall_port_forward_list, firewall_dmz, firewall_wan_access, firewall_rule_list |
| LED | led_config, led_set_enabled |
| WireGuard | wireguard_client_list, wireguard_client_state, wireguard_client_start, wireguard_client_stop |
| Tailscale | tailscale_configured, tailscale_connection_state, tailscale_start, tailscale_stop, tailscale_auth_url, tailscale_exit_node_list |
Responses are typed with TypedDicts (see glinet4/_types.py); the package ships py.typed.
The catalogue of routes still to wrap comes from the sanitised device captures in
glinet-registry.
Todo list:
- Decide on useful endpoints to expose - see https://github.com/HarvsG/ha-glinet-integration#todo
- Expose said endpoints (ongoing — see the table above and glinet4/glinet4 issues)
- Package correctly
- Test that dev enviroment is re-producable
- Publish on pip
- Static typing
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file glinet4-0.1.0.tar.gz.
File metadata
- Download URL: glinet4-0.1.0.tar.gz
- Upload date:
- Size: 149.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fc93692ec75866feff18e20e22f380820580a41f6a722dfcb65d09c73a9e6e3
|
|
| MD5 |
cad5104e8fc4f7b8380213ceb78c490c
|
|
| BLAKE2b-256 |
61a2174c55304e80f71a901469eb36dd37971230aa5fca2ab27b731833f3d764
|
Provenance
The following attestation bundles were made for glinet4-0.1.0.tar.gz:
Publisher:
publish.yml on glinet4/glinet4
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
glinet4-0.1.0.tar.gz -
Subject digest:
9fc93692ec75866feff18e20e22f380820580a41f6a722dfcb65d09c73a9e6e3 - Sigstore transparency entry: 2144581536
- Sigstore integration time:
-
Permalink:
glinet4/glinet4@ab6163a1758de4726fbe59155925b0cfd2dc194c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/glinet4
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ab6163a1758de4726fbe59155925b0cfd2dc194c -
Trigger Event:
release
-
Statement type:
File details
Details for the file glinet4-0.1.0-py3-none-any.whl.
File metadata
- Download URL: glinet4-0.1.0-py3-none-any.whl
- Upload date:
- Size: 29.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76203938eeb040be48fa82a0f4c6e8808f68efa20930844929656fb750fca0c4
|
|
| MD5 |
9759a7ad5ae7f53f861eb00d5f02de5e
|
|
| BLAKE2b-256 |
c46bf4fa37e8fd25c1e043350f9e2ef584b7094ce2446b3290735b6562c87050
|
Provenance
The following attestation bundles were made for glinet4-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on glinet4/glinet4
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
glinet4-0.1.0-py3-none-any.whl -
Subject digest:
76203938eeb040be48fa82a0f4c6e8808f68efa20930844929656fb750fca0c4 - Sigstore transparency entry: 2144581550
- Sigstore integration time:
-
Permalink:
glinet4/glinet4@ab6163a1758de4726fbe59155925b0cfd2dc194c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/glinet4
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ab6163a1758de4726fbe59155925b0cfd2dc194c -
Trigger Event:
release
-
Statement type: