glinet4
Quickstart
import asyncio
from glinet4 import GLinet
async def main() -> None:
async with GLinet("http://192.168.8.1/rpc") as router:
await router.login("root", "your-router-password")
info = await router.router_info()
print(info["model"], info["firmware_version"])
asyncio.run(main())
Swap in your router's host, username and password. login() must succeed before any
other call — see API coverage below for the full method list, and
CONTRIBUTING.md for how the test suite talks to a live router.
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.uvx prek install— sets up the git pre-commit hooks (ruff, mypy, file hygiene). Run them on demand withuvx prek run --all-files.- 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).
See CONTRIBUTING.md for the full contributor flow: running the live suite safely, the pre-commit/CI gates, and how to submit a device capture.
API coverage
Session: login, router_reachable. All other methods require login first.
| Area | Methods |
|---|---|
| System | router_info, router_status, router_load, router_unixtime, router_disk_info, router_usb_info, router_timezone_config, router_mac, router_reboot |
| Network / WAN | ping, wan_upstream_router_detected, wan_cable_state, wan_status, wan_info, ethernet_ports_status, network_mode, network_interfaces_status |
| Network acceleration | network_acceleration, network_acceleration_set |
| Network services | dns_config, dns_providers, arp_table, lan_interfaces, ipv6_config, ddns_config, ddns_status |
| Multi-WAN / repeater / tethering | multiwan_config, multiwan_status, repeater_config, repeater_status, repeater_saved_aps, tethering_status, tethering_config |
| QoS / SQM | qos_config, qos_clients, qos_device_groups, sqm_config |
| Flow statistics | flow_stats_rule, flow_stats_set_enabled, flow_stats_top_apps, flow_stats_clear |
| Clients | clients_list, static_clients_list, connected_clients, clients_status, clients_speed, wan_speed, client_set_blocked, blocked_client_macs |
| WiFi | wifi_ifaces, wifi_iface_set_enabled, wifi_status, wifi_mlo_config |
| Services | adguard_config, tor_config, zerotier_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, wireguard_server_status, wireguard_server_config, wireguard_server_setting, wireguard_server_peers, wireguard_server_routes, wireguard_client_groups, wireguard_client_configs |
| OpenVPN | openvpn_server_status, openvpn_server_config, openvpn_server_setting, openvpn_server_users, openvpn_server_routes, openvpn_client_groups, openvpn_client_configs |
| VPN tunnel state | vpn_client_status, vpn_client_tunnels |
| Tailscale | tailscale_configured, tailscale_connection_state, tailscale_start, tailscale_stop, tailscale_auth_url, tailscale_exit_node_list, tailscale_set_exit_node |
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 submitted to
glinet4-registry — run uvx glinet4-profiler
against your own router to contribute one.
Todo list:
- Decide on useful endpoints to expose
- 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
Versioning & stability
glinet4 is pre-1.0: breaking changes can land in a minor version bump, not just a
major one. CHANGELOG.md (generated by release-please from conventional
commits) is the authoritative record of what changed in each release — check it before
upgrading.
Part of the glinet4 project — glinet4 (Python library) · glinet4-ha (Home Assistant) · glinet4-profiler · glinet4-registry
Metadata
Release files for glinet4 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| glinet4-0.2.4.tar.gz | 49.7 kB | With provenance | Details for glinet4-0.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| glinet4-0.2.4-py3-none-any.whl | Python 3 | none | any | Details for glinet4-0.2.4-py3-none-any.whl |
Total release size: 104.9 kB
Release files / glinet4-0.2.4.tar.gz
| Download URL | glinet4-0.2.4.tar.gz |
|---|---|
| Size | 49.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db883b9c1db570aca285c06a86baab4d51297ab0cbcc07b88496d3ed8026a277
|
|
BLAKE2b-256 checksum How to use checksums |
8554d48b617990354bac58e1c108795d64493dd065d54a3fa86516697afaca39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 13, 2026.
Transparency logRelease files / glinet4-0.2.4-py3-none-any.whl
| Download URL | glinet4-0.2.4-py3-none-any.whl |
|---|---|
| Size | 55.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52b8ef6038d256cc7d9eef97d32609de608227f1bfacf3ee3738ed4c29d7ef4b
|
|
BLAKE2b-256 checksum How to use checksums |
8efa83ccf6e3b7ceadbe5da2c064ee6b0a5601b6634d0b2473f1d5868b99f289
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 13, 2026.
Transparency logSecurity for glinet4 0.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for glinet4-0.2.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.