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'
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).
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gnetclisdk-1.2.25.tar.gz.
File metadata
- Download URL: gnetclisdk-1.2.25.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a839ceaeed8ebd8d4dc8648626e12c4d77888ebdeec4694d5e17684db4872452
|
|
| MD5 |
fdbd0be9361980e4cd16c516ae305f47
|
|
| BLAKE2b-256 |
6a5e6966bf2c03de12687235812bdf52979018138419228002f7be8908cee6aa
|
Provenance
The following attestation bundles were made for gnetclisdk-1.2.25.tar.gz:
Publisher:
publish-to-pypi.yml on annetutil/gnetcli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gnetclisdk-1.2.25.tar.gz -
Subject digest:
a839ceaeed8ebd8d4dc8648626e12c4d77888ebdeec4694d5e17684db4872452 - Sigstore transparency entry: 1437165684
- Sigstore integration time:
-
Permalink:
annetutil/gnetcli@e073c79cff2544b95a5c9c104efba0de0e1daa98 -
Branch / Tag:
refs/tags/v1.2.25 - Owner: https://github.com/annetutil
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@e073c79cff2544b95a5c9c104efba0de0e1daa98 -
Trigger Event:
release
-
Statement type:
File details
Details for the file gnetclisdk-1.2.25-py3-none-any.whl.
File metadata
- Download URL: gnetclisdk-1.2.25-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95ad0349ce4367d70102ea09a166d234e308f70169bd4c5073afb7486c25cc5d
|
|
| MD5 |
4c3c84d15e9248673c9334439d064752
|
|
| BLAKE2b-256 |
b42f3bd8b9655305ae74c0c1e3d97f6fec1c74b4f06ea0c40b980f73b799c022
|
Provenance
The following attestation bundles were made for gnetclisdk-1.2.25-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on annetutil/gnetcli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gnetclisdk-1.2.25-py3-none-any.whl -
Subject digest:
95ad0349ce4367d70102ea09a166d234e308f70169bd4c5073afb7486c25cc5d - Sigstore transparency entry: 1437165695
- Sigstore integration time:
-
Permalink:
annetutil/gnetcli@e073c79cff2544b95a5c9c104efba0de0e1daa98 -
Branch / Tag:
refs/tags/v1.2.25 - Owner: https://github.com/annetutil
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@e073c79cff2544b95a5c9c104efba0de0e1daa98 -
Trigger Event:
release
-
Statement type: