File tree Expand file tree Collapse file tree 4 files changed +75
-3
lines changed Expand file tree Collapse file tree 4 files changed +75
-3
lines changed Original file line number Diff line number Diff line change 1+ # Changelog for netauth-python
2+ All notable changes to this project will be documented in this file.
3+
4+ The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.1.0/ ) ,
5+ and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
6+
7+
8+ ## [ Unreleased]
9+
10+
11+ ## [ 0.1.0] - 2024-08-04
12+ ### Added
13+ - Generated code from protobuf definitions.
14+ - Types for interacting with NetAuth objects.
15+ - Objects and methods for interacting with NetAuth servers over gRPC.
16+ - API documentation.
17+
18+
19+ [ Unreleased ] : https://github.com/netauth/netauth-python/compare/v0.1.0...HEAD
20+ [ 0.1.0 ] : https://github.com/netauth/netauth-python/releases/tag/v0.1.0
Original file line number Diff line number Diff line change 1- # Python 3 interface for NetAuth clients
1+ ## netauth-python
2+
3+ A [ NetAuth] ( https://netauth.org ) client library for Python.
4+
5+ ### Installation
6+
7+ ```
8+ pip install netauth
9+ ```
10+
11+ ### Usage
12+
13+ netauth-python centers around the ` NetAuth ` object:
14+
15+ ``` py
16+ na = netauth.NetAuth(" netauth.example.org" )
17+
18+ try :
19+ resp = na.system_status()
20+ print (resp)
21+ except netauth.error.NetAuthRpcError as e:
22+ print (f " Request failed: { e} " )
23+
24+ na.close()
25+ ```
26+
27+ ` NetAuth ` can also be used as a context manager and be initialized from a NetAuth configuration file:
28+
29+ ``` py
30+ with netauth.NetAuth.with_config(Path(" /etc/netauth/config.toml" )) as na:
31+ try :
32+ resp = na.system_status()
33+ print (resp)
34+ except netauth.error.NetAuthRpcError as e:
35+ print (f " Request failed: { e} " )
36+ ```
37+
38+ For interactive or dynamic applications, operations that require authentication can use a callback to retrieve the user's secret:
39+
40+ ``` py
41+ def secret_cb () -> str :
42+ return getpass(prompt = " Secret: " )
43+
44+ with netauth.NetAuth(" netauth.example.org" , entity = " demo" , secret = secret_cb) as na:
45+ try :
46+ na.entity_kv_add(" demo" , " foo" , [" bar" , " baz" ])
47+ except error.NetAuthRpcError as e:
48+ print (e)
49+ ```
50+
51+ For more information, see the [ API documentation] ( https://python.netauth.org ) .
52+
Original file line number Diff line number Diff line change 3333 "error" ,
3434]
3535
36- __version__ = "0.0.1 "
36+ __version__ = "0.1.0 "
3737
3838
3939class NetAuth :
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ test = [
4141 " pytest" ,
4242]
4343publish = [
44+ " build" ,
4445 " twine" ,
4546]
4647
@@ -51,7 +52,7 @@ Repository = "https://github.com/netauth/netauth-python"
5152Changelog = " https://github.com/netauth/netauth-python/blob/master/CHANGELOG.md"
5253
5354[tool .setuptools ]
54- packages = [" netauth" ]
55+ packages = [" netauth" , " netauth._pb " , " netauth._pb.v2 " ]
5556
5657[tool .setuptools .dynamic ]
5758version = {attr = " netauth.__version__" }
You can’t perform that action at this time.
0 commit comments