## netauth-python
A [NetAuth](https://netauth.org) client library for Python.
### Installation
```
pip install netauth
```
### Usage
netauth-python centers around the `NetAuth` object:
```py
na = netauth.NetAuth("netauth.example.org")
try:
resp = na.system_status()
print(resp)
except netauth.error.NetAuthRpcError as e:
print(f"Request failed: {e}")
na.close()
```
`NetAuth` can also be used as a context manager and be initialized from a NetAuth configuration file:
```py
with netauth.NetAuth.with_config(Path("/etc/netauth/config.toml")) as na:
try:
resp = na.system_status()
print(resp)
except netauth.error.NetAuthRpcError as e:
print(f"Request failed: {e}")
```
For interactive or dynamic applications, operations that require authentication can use a callback to retrieve the user's secret:
```py
def secret_cb() -> str:
return getpass(prompt="Secret: ")
with netauth.NetAuth("netauth.example.org", entity="demo", secret=secret_cb) as na:
try:
na.entity_kv_add("demo", "foo", ["bar", "baz"])
except error.NetAuthRpcError as e:
print(e)
```
For more information, see the [API documentation](https://python.netauth.org).
Raw data
{
"_id": null,
"home_page": null,
"name": "netauth",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "secure-access, authentication-service, netauth",
"author": null,
"author_email": "classabbyamp <dev@placeviolette.net>",
"download_url": "https://files.pythonhosted.org/packages/c4/9d/33f6e49de92e701db063fadac6665d9b3cc79fd324a2af0d26b77322800c/netauth-0.1.0.tar.gz",
"platform": null,
"description": "## netauth-python\n\nA [NetAuth](https://netauth.org) client library for Python.\n\n### Installation\n\n```\npip install netauth\n```\n\n### Usage\n\nnetauth-python centers around the `NetAuth` object:\n\n```py\nna = netauth.NetAuth(\"netauth.example.org\")\n\ntry:\n resp = na.system_status()\n print(resp)\nexcept netauth.error.NetAuthRpcError as e:\n print(f\"Request failed: {e}\")\n\nna.close()\n```\n\n`NetAuth` can also be used as a context manager and be initialized from a NetAuth configuration file:\n\n```py\nwith netauth.NetAuth.with_config(Path(\"/etc/netauth/config.toml\")) as na:\n try:\n resp = na.system_status()\n print(resp)\n except netauth.error.NetAuthRpcError as e:\n print(f\"Request failed: {e}\")\n```\n\nFor interactive or dynamic applications, operations that require authentication can use a callback to retrieve the user's secret:\n\n```py\ndef secret_cb() -> str:\n return getpass(prompt=\"Secret: \")\n\nwith netauth.NetAuth(\"netauth.example.org\", entity=\"demo\", secret=secret_cb) as na:\n try:\n na.entity_kv_add(\"demo\", \"foo\", [\"bar\", \"baz\"])\n except error.NetAuthRpcError as e:\n print(e)\n```\n\nFor more information, see the [API documentation](https://python.netauth.org).\n\n",
"bugtrack_url": null,
"license": null,
"summary": "NetAuth client library",
"version": "0.1.0",
"project_urls": {
"Changelog": "https://github.com/netauth/netauth-python/blob/master/CHANGELOG.md",
"Documentation": "https://python.netauth.org",
"Homepage": "https://netauth.org",
"Repository": "https://github.com/netauth/netauth-python"
},
"split_keywords": [
"secure-access",
" authentication-service",
" netauth"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7314bd60f3bb3543b881634974874839e335312bafecd5ed22d8a76f43b51498",
"md5": "78da2c048ca4eda0b1c65e9f0fca9457",
"sha256": "6ebaba71c3675981f9370eaf70f6a51a92f345c85a162bd80ab97c2d76ea852e"
},
"downloads": -1,
"filename": "netauth-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "78da2c048ca4eda0b1c65e9f0fca9457",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 24712,
"upload_time": "2024-08-04T19:20:13",
"upload_time_iso_8601": "2024-08-04T19:20:13.227823Z",
"url": "https://files.pythonhosted.org/packages/73/14/bd60f3bb3543b881634974874839e335312bafecd5ed22d8a76f43b51498/netauth-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c49d33f6e49de92e701db063fadac6665d9b3cc79fd324a2af0d26b77322800c",
"md5": "81fb9bb4a97b72ded91393d11f97655d",
"sha256": "e5b94e08f9832e643d655fe53dbeb8b5dc7c696a7745df61d42e027426f18e3f"
},
"downloads": -1,
"filename": "netauth-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "81fb9bb4a97b72ded91393d11f97655d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 26157,
"upload_time": "2024-08-04T19:20:14",
"upload_time_iso_8601": "2024-08-04T19:20:14.938019Z",
"url": "https://files.pythonhosted.org/packages/c4/9d/33f6e49de92e701db063fadac6665d9b3cc79fd324a2af0d26b77322800c/netauth-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-04 19:20:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "netauth",
"github_project": "netauth-python",
"github_not_found": true,
"lcname": "netauth"
}