Skip to main content

Client for Gnetcli GRPC-server

Project description

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.

Example:

from gnetclisdk.client import Credentials, Gnetcli, HostParams
import os, asyncio

async def example():
    api = Gnetcli(insecure_grpc=True)
    # api = Gnetcli(insecure_grpc=True, auth_token="Basic " + base64.b64encode(f"{username}:{password}".encode('utf-8')).decode("ascii")
    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'

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gnetclisdk-1.2.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gnetclisdk-1.2.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file gnetclisdk-1.2.0.tar.gz.

File metadata

  • Download URL: gnetclisdk-1.2.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gnetclisdk-1.2.0.tar.gz
Algorithm Hash digest
SHA256 7c6f41d8abd0c63ec60e75f777fe1f4bfe28fcbc4b8077796e82c7ba724d3e7e
MD5 eacb64dff2fe30c26d9f07bdc54c91e6
BLAKE2b-256 5c6bc4166ea188717b28f40f30ae9e24d9d2b39df3f20f660689bbef98e12881

See more details on using hashes here.

Provenance

The following attestation bundles were made for gnetclisdk-1.2.0.tar.gz:

Publisher: publish-to-pypi.yml on annetutil/gnetcli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gnetclisdk-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: gnetclisdk-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gnetclisdk-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 407b9e3b9f0e4287b4d31c3056b5238e2d8a84a0c00b5e61322a56ba6707f2cd
MD5 1a86f7c720ac7d7e7c8943767776e261
BLAKE2b-256 e6589e286e525116a266fe2699e8a864e8de0d571588ffb81262b34dbc06d4ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for gnetclisdk-1.2.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on annetutil/gnetcli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page