Access to Azure Storage/Secrets/Keyvault for Shopify Apps built with Python.
Project description
Azure resource access library for Shopify Apps
The motivation for this library arose out of a data analysis project for a Shopify Store.
This package allows easy access to some Azure resources, particullarly:
- create/delete a keyvault
- populate keyvault with Shopify relevant secrets
- read secrets
- convert
list[dict]
data to JSON, CSV and Excel - store data in Azure blob
The source for this project is available here.
Sample usage
Install package with pip install azurify
create your environment variables:
AZURE_DEFAULT_OBJECT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
AZURE_TENANT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
AZURE_CLIENT_SECRET=xxxxxx-xxxxxxxxxxxx-xxxxxxxxxx-xxxxxxxx
AZURE_DEFAULT_GROUP_NAME=my-resources
AZURE_SUBSCRIPTION_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
AZURE_CLIENT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
AZURE_DEFAULT_LOCATION=uscentral
Run:
from azure.identity import DefaultAzureCredential
from azurify.azsecrets import AzureSecrets
AZURE_KEYVAULT_NAME = "enter your keyvault name here"
def main():
"""Simple test case"""
azsecrets = AzureSecrets(
vault_url=f"https://{AZURE_KEYVAULT_NAME}.vault.azure.net/",
credential=DefaultAzureCredential(),
)
print(azsecrets.SHOPDOMAIN)
if __name__ == "__main__":
main()
Prints myshop.myshopify.com
Package structure
.
├── LICENSE
├── Readme.md
├── azurify
│ ├── Readme.md
│ ├── __init__.py
│ ├── azconverter.py
│ ├── azkeyvault.py
│ ├── azsecrets.py
│ ├── azstorage.py
│ ├── test_azconverter.py
│ ├── test_azkeyvault.py
│ ├── test_azsecrets.py
│ └── test_azstorage.py
├── requirements.txt
├── run.py
└── setup.py
Package creation
Assuming package resides in directory azurify
.
First run run.py
to check everthing is functioning.
Creating the package
cd azurify
pip install wheel
python3 setup.py bdist_wheel sdist
Local testing
Directory structure:
.
├── azurify
└── testazurify
cd testazurify
python3 -m venv .venv
source .venv/bin/activate
pip install -e ../azurify
Upload to test repository
cd ../azurify
pip install twine
twine check dist/*
twine upload -r testpypi dist/*
Upload to PyPi
twine upload dist/*
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
azurify-0.72.tar.gz
(9.3 kB
view details)
Built Distribution
azurify-0.72-py3-none-any.whl
(11.3 kB
view details)
File details
Details for the file azurify-0.72.tar.gz
.
File metadata
- Download URL: azurify-0.72.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea617b421c571f96050fb3a2dfe7ba8a00ce266f4b2450e16ce9e1d1ab4e3721 |
|
MD5 | cef4992bec7afc7344f9d0ab89dcfb74 |
|
BLAKE2b-256 | 089ea641415068a2def7671f0195d3ed1814dfb7c07e76cf2d2246f0b26e8569 |
File details
Details for the file azurify-0.72-py3-none-any.whl
.
File metadata
- Download URL: azurify-0.72-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b50d98ca09a6a20f15462507c31a857df333918b7a18ae5c6c26bcceb3a2e69 |
|
MD5 | 86baa8120caef6cf8b1a464e4d695962 |
|
BLAKE2b-256 | 838abbd93994268c5dd67fd7cf85122252775aff4908c4222cb75cb9695f4424 |