## 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](https://annetutil.github.io/gnetcli/).
Example:
```python
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'
```
Raw data
{
"_id": null,
"home_page": "https://github.com/annetutil/gnetcli",
"name": "gnetclisdk",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Alexander Balezin",
"author_email": "gescheit12@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/1f/92/fdef12a87db461c19fc0cfba3723916fda1c6f4f4d349ff89b342e20980c/gnetclisdk-1.0.70.tar.gz",
"platform": null,
"description": "## Python client for Gnetcli GRPC server\n\nGnetcli provides a universal way to execute arbitrary commands using a CLI,\neliminating the need for screen scraping with expect.\n\nSee documentation on [gnetcli server](https://annetutil.github.io/gnetcli/).\n\nExample:\n\n```python\nfrom gnetclisdk.client import Credentials, Gnetcli, HostParams\nimport os, asyncio\n\nasync def example():\n api = Gnetcli(insecure_grpc=True)\n # api = Gnetcli(insecure_grpc=True, auth_token=\"Basic \" + base64.b64encode(f\"{username}:{password}\".encode('utf-8')).decode(\"ascii\")\n dev_creds = Credentials(os.environ.get(\"LOGIN\"), os.environ.get(\"PASSWORD\"))\n res = await api.cmd(hostname=\"myhost\", cmd=\"dis clock\", host_params=HostParams(device=\"huawei\", credentials=dev_creds))\n print(\"err=%s status=%s out=%s\" % (res.error, res.status, res.out))\n\nasyncio.run(example())\n```\n\nOutput:\n```\nerr=b'' status=0 out=b'2023-11-10 09:31:58\\nFriday\\nTime Zone(UTC) : UTC'\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Client for Gnetcli GRPC-server",
"version": "1.0.70",
"project_urls": {
"Homepage": "https://github.com/annetutil/gnetcli"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "1da2a587eec2fec03b1f96f8e396acb035ac311bd4b00611cfefacb485ad5c50",
"md5": "41c01ff51460dfa13c1e69d3cf223dc4",
"sha256": "53d2e84487a740be63143833a75d2340cbfca5c5644beabf76b72c9fea92cea2"
},
"downloads": -1,
"filename": "gnetclisdk-1.0.70-py3-none-any.whl",
"has_sig": false,
"md5_digest": "41c01ff51460dfa13c1e69d3cf223dc4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 14545,
"upload_time": "2025-02-17T13:42:00",
"upload_time_iso_8601": "2025-02-17T13:42:00.017248Z",
"url": "https://files.pythonhosted.org/packages/1d/a2/a587eec2fec03b1f96f8e396acb035ac311bd4b00611cfefacb485ad5c50/gnetclisdk-1.0.70-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1f92fdef12a87db461c19fc0cfba3723916fda1c6f4f4d349ff89b342e20980c",
"md5": "cd9318e63c49ae655d93822e5b330a51",
"sha256": "9b8dd43dc901aba54d8a9e8ec6b445e0944d542d1671306533378c0a753f5eca"
},
"downloads": -1,
"filename": "gnetclisdk-1.0.70.tar.gz",
"has_sig": false,
"md5_digest": "cd9318e63c49ae655d93822e5b330a51",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13869,
"upload_time": "2025-02-17T13:42:02",
"upload_time_iso_8601": "2025-02-17T13:42:02.004264Z",
"url": "https://files.pythonhosted.org/packages/1f/92/fdef12a87db461c19fc0cfba3723916fda1c6f4f4d349ff89b342e20980c/gnetclisdk-1.0.70.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-17 13:42:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "annetutil",
"github_project": "gnetcli",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "gnetclisdk"
}