This release is a pre-release and may not be stable for production use.
nitlsconfig
Python API that reads nitlsconfig configurations through the nitlsconfig command line,
and builds gRPC client channels from them.
Installed and imported as nitlsconfig; developed at
ni/nitlsconfig-python.
Runtime dependencies
- nitlsconfig executable, discoverable, or explicit path to NITLSCONFIG_CLI
Install
Reading NI-TLS configuration is pure Python and has no third-party dependencies:
pip install nitlsconfig
The gRPC channel factory additionally needs grpcio, which is an optional extra:
pip install nitlsconfig[grpc]
Creating a gRPC channel
create_grpc_client_channel reads the local NI-TLS client configuration and returns a
grpc.Channel secured accordingly. The server_address hostname or address is used to
select matching target-specific NI-TLS settings. Pass the channel straight to any NI
gRPC Python API:
import nidcpower
import nitlsconfig
with nitlsconfig.create_grpc_client_channel("localhost", 31763) as channel:
options = nidcpower.GrpcSessionOptions(channel, "")
with nidcpower.Session("Dev1", grpc_options=options) as session:
...
The channel is mutually authenticated, one-way TLS, or insecure depending on how the machine is configured; no code change is needed to move between them. The channel is owned by the caller - NI driver APIs never close it.
Retries are opt-in:
channel = nitlsconfig.create_grpc_client_channel(
"localhost", 31763, retry_policy=nitlsconfig.RetryPolicy()
)
TlsConfigurationError is raised when TLS is enabled but the configuration is
unusable. Accessing any of these names without the grpc extra installed raises
ImportError telling you which extra to install.
Reading configurations
import nitlsconfig
# List configured services
clients = nitlsconfig.ClientConfig.list_services()
servers = nitlsconfig.ServerConfig.list_services()
if clients:
# Read one client configuration
client_info = nitlsconfig.ClientConfig(clients[0])
print(client_info.service_name)
print(client_info.certificate_mode)
print(client_info.certificate_chain_location.scheme)
print(client_info.certificate_chain_location.path)
print(client_info.certificate_chain_contents)
# Inspect target-specific configurations
for known_server in client_info.known_servers:
print(known_server.server_name)
print(known_server.server_mode)
print(known_server.trusted_certificates_location)
if servers:
# Read one server configuration
server_info = nitlsconfig.ServerConfig(servers[0])
print(server_info.service_name)
print(server_info.certificate_mode)
print(server_info.client_mode)
print(server_info.certificate_chain_location.scheme)
print(server_info.certificate_key_location.scheme)
print(server_info.trusted_certificates_location.scheme)
print(server_info.trusted_certificates_contents)
print(server_info.certificate_key_contents)
# Enumerate trusted certificates
for cert in server_info.trusted_certificates:
print(cert.display_name)
print(cert.trusted_certificate_location.path)
print(cert.trusted_certificate_contents)
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 nitlsconfig-1.0.0a1.tar.gz.
File metadata
- Download URL: nitlsconfig-1.0.0a1.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6070a106cc72ec3f1ab84617f95b0e0cd6c4da297498aff1a608b23fad206371
|
|
| MD5 |
3b71af07e550eaa4c4f64f56bbdd7fbf
|
|
| BLAKE2b-256 |
f6935a459ce525184ba9506918441d3d924d43fffabb98ea7ddce811e4d4d210
|
Provenance
The following attestation bundles were made for nitlsconfig-1.0.0a1.tar.gz:
Publisher:
publish.yml on ni/nitlsconfig-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nitlsconfig-1.0.0a1.tar.gz -
Subject digest:
6070a106cc72ec3f1ab84617f95b0e0cd6c4da297498aff1a608b23fad206371 - Sigstore transparency entry: 2533052692
- Sigstore integration time:
-
Permalink:
ni/nitlsconfig-python@be259f34165ebbfbcd144d878e2896ed17e9003b -
Branch / Tag:
refs/tags/1.0.0a1 - Owner: https://github.com/ni
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@be259f34165ebbfbcd144d878e2896ed17e9003b -
Trigger Event:
release
-
Statement type:
File details
Details for the file nitlsconfig-1.0.0a1-py3-none-any.whl.
File metadata
- Download URL: nitlsconfig-1.0.0a1-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
daf3f4503c8aa933196c4b4837ae4e1307f7ba67d1569c373cdeb40b559bba2c
|
|
| MD5 |
d256bbb2aa35ed59df69987ad5a7cf15
|
|
| BLAKE2b-256 |
b5e94a660db4d33b444908417d3a08191b90a1cffc592f80632d7a1296edf986
|
Provenance
The following attestation bundles were made for nitlsconfig-1.0.0a1-py3-none-any.whl:
Publisher:
publish.yml on ni/nitlsconfig-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nitlsconfig-1.0.0a1-py3-none-any.whl -
Subject digest:
daf3f4503c8aa933196c4b4837ae4e1307f7ba67d1569c373cdeb40b559bba2c - Sigstore transparency entry: 2533053116
- Sigstore integration time:
-
Permalink:
ni/nitlsconfig-python@be259f34165ebbfbcd144d878e2896ed17e9003b -
Branch / Tag:
refs/tags/1.0.0a1 - Owner: https://github.com/ni
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@be259f34165ebbfbcd144d878e2896ed17e9003b -
Trigger Event:
release
-
Statement type: