Skip to main content

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

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

Source distribution (sdist)

Source distribution for gnetclisdk 1.3.24
File Size Uploaded Provenance Actions
gnetclisdk-1.3.24.tar.gz 18.8 kB With provenance Details for gnetclisdk-1.3.24.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gnetclisdk 1.3.24
File Interpreter ABI Platform Actions
gnetclisdk-1.3.24-py3-none-any.whl Python 3 none any Details for gnetclisdk-1.3.24-py3-none-any.whl

Total release size: 36.5 kB

Release files / gnetclisdk-1.3.24.tar.gz

Download URL gnetclisdk-1.3.24.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f1523fba3c9f0085d73c5a72c14ab0cd1ae631efe063d934001fada358db7585
BLAKE2b-256 checksum
How to use checksums
2290a2344e68d3b0e2a7e5b0ac5eaf0cc5c036923c62206d0ae7bf66167951da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 29, 2026.

Transparency log

Release files / gnetclisdk-1.3.24-py3-none-any.whl

Download URL gnetclisdk-1.3.24-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20383bef77326082f4ca0f4a67fc8c566d42a5f258135e372b1d41f7844c4112
BLAKE2b-256 checksum
How to use checksums
1c2e76fe5ebd57bfadba31e3c167f12ae3fb3de087038e16b336a261bfedc06e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 29, 2026.

Transparency log

Security for gnetclisdk 1.3.24

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.

Select from 2 files

Attestation for gnetclisdk-1.3.24.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 29, 2026.

Transparency log

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

Release history Release notifications | RSS feed

This release

1.3.24 This release

2 release files Full provenance

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