Pydantic extention to work with Azure Key Vaults
Project description
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_ID
see more
Run tests
tox
TODO:
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
Close
Hashes for pydantic-azure-secrets-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 307a755de467abac633b618849d07a44b988f164c1159a567afc4099eea59d5c |
|
MD5 | 19bb7618672e633e5aeee7bfb69d1dcb |
|
BLAKE2b-256 | 1403d714f611bef60e927299b0711607f7a99fd2def3999c97d66b1db0acc83d |
Close
Hashes for pydantic_azure_secrets-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f40ca71eabacecf5c14034974c2c32374a5ef3aec64d6120c1096fa115fe8039 |
|
MD5 | 280131e9180dfda355126681be84d9d7 |
|
BLAKE2b-256 | 3d286353fb067cc6ad137d971db4236f1daa4bda767c6b7ada93c8bfbc31ffb1 |