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

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.23
File Size Uploaded Provenance Actions
gnetclisdk-1.3.23.tar.gz 18.8 kB With provenance Details for gnetclisdk-1.3.23.tar.gz

Built distribution (wheel)

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

Total release size: 36.5 kB

Release files / gnetclisdk-1.3.23.tar.gz

Download URL gnetclisdk-1.3.23.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4ae981d8e42b26f797d016c2d62ea2da5d2d701e08ea92ebfb1e91c549f0f3b5
BLAKE2b-256 checksum
How to use checksums
038f430160f5003501af47a4c79bbc1d7cdd3b1f6d86af7049c152a887ada1fe
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.23-py3-none-any.whl

Download URL gnetclisdk-1.3.23-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d102c310230299a166afaf980c394e9212d980c5ec5cc19f07c37265d0b77f8
BLAKE2b-256 checksum
How to use checksums
b9287a9bafb73454215daeffa3781f326686db391d9c833dd16adb1dc6054f05
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.23

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