Python client for Gnetcli GRPC server
Gnetcli provides a universal way to execute arbitrary commands using a CLI, eliminating the need for screen scraping with expect.
See documentation on gnetcli server.
Start the server on 127.0.0.1:50051 with explicit authentication.
Set GNETCLI_AUTH to Basic <base64(server-login:server-password)>;
LOGIN/PASSWORD below are the device credentials. Plaintext gRPC is for
local testing only. See the server guide for TLS.
Example:
from gnetclisdk.client import Credentials, Gnetcli, HostParams
import os, asyncio
async def example():
api = Gnetcli(server="localhost:50051", insecure_grpc=True, auth_token=os.environ["GNETCLI_AUTH"])
dev_creds = Credentials(os.environ.get("LOGIN"), os.environ.get("PASSWORD"))
res = await api.cmd(hostname="myhost", cmd="dis clock", host_params=HostParams(device="huawei", credentials=dev_creds))
print("err=%s status=%s out=%s" % (res.error, res.status, res.out))
asyncio.run(example())
Output:
err=b'' status=0 out=b'2023-11-10 09:31:58\nFriday\nTime Zone(UTC) : UTC'
Tests
From this directory, with Go on PATH (to build gnetcli_server and gswitch):
python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt -r requirements-test.txt -e .
pytest tests/
Optional: GNETCLI_TEST_PREBUILT_DIR — directory that already contains gnetcli_server and gswitch binaries (skip go build in tests).
Metadata
Release files for gnetclisdk 1.3.22
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 |
|---|---|---|---|---|
| gnetclisdk-1.3.22.tar.gz | 18.8 kB | With provenance | Details for gnetclisdk-1.3.22.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gnetclisdk-1.3.22-py3-none-any.whl | Python 3 | none | any | Details for gnetclisdk-1.3.22-py3-none-any.whl |
Total release size: 36.5 kB
Release files / gnetclisdk-1.3.22.tar.gz
| Download URL | gnetclisdk-1.3.22.tar.gz |
|---|---|
| Size | 18.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd39ead07a08eae0e85c9e2f691670b1e6223de44497b79dd9ad9b3d75705023
|
|
BLAKE2b-256 checksum How to use checksums |
1633726bd048d44bfbd41306a42372135141fdbfc1a5e95ef579d2b8815d02a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 18, 2026.
Transparency logRelease files / gnetclisdk-1.3.22-py3-none-any.whl
| Download URL | gnetclisdk-1.3.22-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
87462594ebc50bda2ef26b6cd89de7ce6a1355daac9f38f5b1d0c3e9bc3dce5e
|
|
BLAKE2b-256 checksum How to use checksums |
604b8c0b1170335a48da61812320a86ec5ab06e428fdb0d2b2e1b8f220a4cdc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 18, 2026.
Transparency logSecurity for gnetclisdk 1.3.22
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
Both files in this release have been uploaded with provenance metadata.
Attestation for gnetclisdk-1.3.22.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 Oct 18, 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.