Flask extension to read and write secrets from Azure Key Vault
Project description
Flask-KeyVault
A Flask extension to read and write secrets using Azure Key Vault.
Installation
$ pip install Flask-KeyVault
Usage
import os
from flask import Flask
from flask_keyvault import AzureKeyVault
from flask_keyvault.exceptions import KeyVaultAuthenticationError
demo = Flask(__name__)
demo.config.update(
AZURE_CLIENT_ID = os.getenv('AZURE_CLIENT_ID','YOUR-AZURE_CLIENT_ID'),
AZURE_SECRET = os.getenv('AZURE_SECRET', 'YOUR-AZURE-SECRET'),
AZURE_TENANT = os.getenv('AZURE_TENANT', 'YOUR-AZURE-TENANT')
)
keyvault = AzureKeyVault()
keyvault.init_app(demo)
key_vault_url = 'https://mykeyvault.vault.azure.net/'
@demo.route('/')
def index():
try:
my_secret = keyvault.get(key_vault_url, "my_secret", 1)
return my_secret
except KeyVaultAuthenticationError:
return "authentication error"
demo.run(debug=True)
Contributing
Questions, comments or improvements, please create an issue on Github.
To suggest a change to the code or documentation, please create a new pull request on GitHub. Also, please squash multiple commits into a single commit in your pull request by rebasing onto the master branch.
License
Flask-KeyVault is licensed under the MIT license.
Contact
Erik Howard erikhoward@protonmail.com, @erik_howard.
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
Flask-KeyVault-0.5.0.tar.gz
(3.4 kB
view details)
Built Distribution
File details
Details for the file Flask-KeyVault-0.5.0.tar.gz
.
File metadata
- Download URL: Flask-KeyVault-0.5.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | add0461b6c972c031536ebe2e0133100531e58d8e2f07ad0c3b0486a4a3e9b61 |
|
MD5 | 7405c3ae0a1cc4b443468731c4d70faf |
|
BLAKE2b-256 | df031b3387397047e94a5958015438ced7249f88016902b2da3966ab22fe8111 |
File details
Details for the file Flask_KeyVault-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: Flask_KeyVault-0.5.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f78cae60b925cde80f41fe1b2e158fb1139c93839759f0a3eaba1987ab7802d4 |
|
MD5 | 6f0156fb9c081fbb95dd95da2b137928 |
|
BLAKE2b-256 | 8a0560940779ec8acd2cbd7e912f94d1f12ea342aa025195ff11fd0671bfac07 |