Skip to main content

Pydantic extention to work with Azure Key Vaults

Project description

pydantic-azure-secrets

A class to use pydantic settings together with Azure KeyVault

tests

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydantic-azure-secrets-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydantic_azure_secrets-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file pydantic-azure-secrets-0.1.0.tar.gz.

File metadata

  • Download URL: pydantic-azure-secrets-0.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pydantic-azure-secrets-0.1.0.tar.gz
Algorithm Hash digest
SHA256 307a755de467abac633b618849d07a44b988f164c1159a567afc4099eea59d5c
MD5 19bb7618672e633e5aeee7bfb69d1dcb
BLAKE2b-256 1403d714f611bef60e927299b0711607f7a99fd2def3999c97d66b1db0acc83d

See more details on using hashes here.

File details

Details for the file pydantic_azure_secrets-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pydantic_azure_secrets-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for pydantic_azure_secrets-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f40ca71eabacecf5c14034974c2c32374a5ef3aec64d6120c1096fa115fe8039
MD5 280131e9180dfda355126681be84d9d7
BLAKE2b-256 3d286353fb067cc6ad137d971db4236f1daa4bda767c6b7ada93c8bfbc31ffb1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page