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

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.25
File Size Uploaded Provenance Actions
gnetclisdk-1.3.25.tar.gz 20.1 kB With provenance Details for gnetclisdk-1.3.25.tar.gz

Built distribution (wheel)

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

Total release size: 38.3 kB

Release files / gnetclisdk-1.3.25.tar.gz

Download URL gnetclisdk-1.3.25.tar.gz
Size 20.1 kB
Tags Source
SHA-256 checksum
How to use checksums
73756d3bca7ed0972f18236f2e47cc3ade8f2216b60872c6c40f53b9bd0259cb
BLAKE2b-256 checksum
How to use checksums
5d8a293f2af50cd7fd48d661d0ee8e0b446f74de3c57f2d8d606258880678d47
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 Nov 17, 2026.

Transparency log

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

Download URL gnetclisdk-1.3.25-py3-none-any.whl
Size 18.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d4090bd2fea275b6d29eae147d12cbd55943baac62ed8dadaa368364dd87d39
BLAKE2b-256 checksum
How to use checksums
11c5aa445d59504605ca6a58827f3dcb11ac08bde34cda9cf2d1329767d67e44
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 Nov 17, 2026.

Transparency log

Security for gnetclisdk 1.3.25

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.25.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 Nov 17, 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.25 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