Toolkit for Python backend template
Project description
aicsapi-tool-python
| .gitignore
| .kvvars # specifies environment variables needed by "keyvault_certgen.py" & "keyvault_utils.py"
| LICENSE
| README.md
| requirements.txt # package dependencies
| requirements_dev.txt # required for packaging
| setup.py # for wrapping into a PyPI package
|
+---aicsapi_tool_python # actual codes
appinsight_transport.py # for logging custom events to Azure Appinsights
keyvault_certgen.py # provides utilities to generate X509v3 cert and upload to Azure KV
keyvault_tokenCache.py # for caching credentials to save login time
keyvault_utils.py # device-code sign in to Azure, get/import secret & cert to Azure KV
__init__.py
Description
A package to help Python API template in:
- Logging to Azure Application Insights
- Fetching secret from Azure Key Vault
- Generating self-signed certificate and upload it to Azure Key Vault
- Caching credential token to save login time
Installation
This package has been published to PyPI, so you can use
pip install aicsapi-tool-python
Note
When calling methods in keyvault_utils
or keyvault_certgen
, be sure to have the following environment variables set:
KEY_VAULT_URL
KEY_VAULT_SECRET_NAME
KEY_VAULT_CERT_NAME
Example: Generate Self-signed Certification and Upload to Azure KV
- Ensure required env. variables are loaded, create
.kvvars
under current working directory
KEY_VAULT_URL="https://[your keyvault name].vault.azure.net"
KEY_VAULT_CERT_NAME="certificate name"
- Run the following code snippet with
python certgen.py [your ASUS account name] [filename of generated key & cert]
# certgen.py
from aicsapi_tool_python.keyvault_certgen import generate_v3cert, upload_v3cert_to_kv
import sys
asus_account = sys.argv[1]
cert_name = sys.argv[2]
generate_v3cert( asus_account, cert_name )
upload_v3cert_to_kv( cert_name + '.pfx' )
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
Built Distribution
File details
Details for the file aicsapi-tool-python-0.2.7.tar.gz
.
File metadata
- Download URL: aicsapi-tool-python-0.2.7.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42448c768d38fc46bb05abb478899638b39fc8c1560a975ff21c866ee3d029ac |
|
MD5 | 8cf0b5eb9a3bedb9e948caf5e411e0c0 |
|
BLAKE2b-256 | 55289e6aba70dcbb63fcefd02d7e277568e02ef207c0d7e2de6368eeab95f45e |
File details
Details for the file aicsapi_tool_python-0.2.7-py3-none-any.whl
.
File metadata
- Download URL: aicsapi_tool_python-0.2.7-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 567c4dfc4836c33bdd99876cf40ee8fde6ee8f9bc53104be0e28c86ca9ce16cb |
|
MD5 | 3215dfd4b9b2ab7c95c1ac0fa9829b28 |
|
BLAKE2b-256 | 6ba5d45b755c9f13a15064c2cbd4738a49513e0eaf3aa3445ffc286747c01f91 |