pydantic-azure-secrets
A class to use pydantic settings together with Azure KeyVault
The behaviour of the class is exactly like in pydantic.BaseSettings, except the step which checks azure key vault:
settings_args > envs > dotenv > secret_directory > azure_keyvault > defaults
Install:
pip install pydantic-azure-secrets
Example:
# Example for GitHub REST API
from pydantic import HttpUrl, SecretStr
from pydantic_azure_secrets import AzureVaultSettings
class GitHubBasic(AzureVaultSettings):
url: HttpUrl = "https://api.github.com/user"
username: str
token: SecretStr
class Config:
env_prefix = "github_"
azure_keyvault = <your_keyvault_URI> # e.g. "https://pydantic-test-kv.vault.azure.net/"
github_settings = GitHubBasic()
# GitHubBasic(url=HttpUrl('https://github.com', scheme='https', host='github.com', tld='com', host_type='domain'), username='kewtree1408', token=SecretStr('**********'))
See more examples in the example.py
Authentification
Authentification for azure keyvault is the same as for SDK
Before using the library, please log in to your Azure subscription with one of the following methods
- az login
- environment variables:
AZURE_CLIENT_ID,AZURE_CLIENT_PASSWORD,AZURE_TENANT_IDsee more
Run tests
tox
TODO:
Metadata
Release files for pydantic-azure-secrets 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pydantic-azure-secrets-0.1.0.tar.gz | 5.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydantic_azure_secrets-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.9 kB
Release files / pydantic-azure-secrets-0.1.0.tar.gz
| Download URL | pydantic-azure-secrets-0.1.0.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
307a755de467abac633b618849d07a44b988f164c1159a567afc4099eea59d5c
|
|
BLAKE2b-256 checksum How to use checksums |
1403d714f611bef60e927299b0711607f7a99fd2def3999c97d66b1db0acc83d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1
|
Release files / pydantic_azure_secrets-0.1.0-py3-none-any.whl
| Download URL | pydantic_azure_secrets-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f40ca71eabacecf5c14034974c2c32374a5ef3aec64d6120c1096fa115fe8039
|
|
BLAKE2b-256 checksum How to use checksums |
3d286353fb067cc6ad137d971db4236f1daa4bda767c6b7ada93c8bfbc31ffb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1
|