NetAuth client library
Project description
netauth-python
A NetAuth client library for Python.
Installation
pip install netauth
Usage
netauth-python centers around the NetAuth object:
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:
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:
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.
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 netauth-0.1.0.tar.gz.
File metadata
- Download URL: netauth-0.1.0.tar.gz
- Upload date:
- Size: 26.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5b94e08f9832e643d655fe53dbeb8b5dc7c696a7745df61d42e027426f18e3f
|
|
| MD5 |
81fb9bb4a97b72ded91393d11f97655d
|
|
| BLAKE2b-256 |
c49d33f6e49de92e701db063fadac6665d9b3cc79fd324a2af0d26b77322800c
|
File details
Details for the file netauth-0.1.0-py3-none-any.whl.
File metadata
- Download URL: netauth-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ebaba71c3675981f9370eaf70f6a51a92f345c85a162bd80ab97c2d76ea852e
|
|
| MD5 |
78da2c048ca4eda0b1c65e9f0fca9457
|
|
| BLAKE2b-256 |
7314bd60f3bb3543b881634974874839e335312bafecd5ed22d8a76f43b51498
|