Skip to main content

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 w/ correlation id 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
|
\---tests        # test_*.py performs unit test for the corresponding module
        test_appinsight_transport.py
        test_keyvault_certgen.py
        test_keyvault_tokenCache.py
        test_keyvault_utils.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
AZURE_TENANT_ID

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"
AZURE_TENANT_ID="your azure tenant id"
  • 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' )

Metadata

Release files for aicsapi-tool-python 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aicsapi-tool-python 0.3.2
File Size Uploaded
aicsapi-tool-python-0.3.2.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aicsapi-tool-python 0.3.2
File Interpreter ABI Platform
aicsapi_tool_python-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.1 kB

Release files / aicsapi-tool-python-0.3.2.tar.gz

Download URL aicsapi-tool-python-0.3.2.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4989143279f722c921cffa23c6306fba708cd15708cc50f43a96aef419b4302e
BLAKE2b-256 checksum
How to use checksums
51638d5f174347d51798b7dd815158dfc67a9e873237229890aed02121a31801
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / aicsapi_tool_python-0.3.2-py3-none-any.whl

Download URL aicsapi_tool_python-0.3.2-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9708350e41fe4e92b689574582bc80fe8ae7740e98bddb8857e8fc3cba3ca3c7
BLAKE2b-256 checksum
How to use checksums
4e6a45b3319c31a5ad227aea750acd0a445b5fcdb1f00eee15615ac9ab9da848
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.0

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.1.5

2 release files

0.1.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page