Setting Up Your API Key File
Overview
The ZoneVu Python SDK supports automatic API Key loading through a configuration file stored in a designated folder on your computer. By placing your API Key into a JSON file in the expected directory, the SDK can read your key without you having to include it manually in your scripts.
Using an API Key File provides several advantages:
Keeps your API Key out of your source code
Reduces risk of accidental exposure when sharing scripts
Prerequisites
Before creating an API Key File, ensure you have:
A valid API Key (Creating your API Key)
The ZoneVu Python SDK installed via: (PyPI Project)
pip install zonevuCreating your Config File
The ZoneVu SDK can look for a configuration file in a specific directory on your C‑drive.
Open File Explorer.
Navigate to your user directory
Save a .json file with the name 'zonevu_keyfile.json'
The file path will look like:
C:\Users\YourUserName\zonevu_keyfile.jsonInside the JSON file, paste the following JSON structure:
{
"apikey": "xXxXxXx-xXxXxXx-xXxXxXxX"
}Note: Replace 'XxXxXx-xXxXxXx-xXxXxXxX with your actual API Key
Finally, save and close your JSON file.
Using your Config File
The ZoneVu Python SDK can now read this Config File and authenticate automatically.
Use the command below in your scripts to load your API Key:
from zonevu.Zonevu import Zonevu
zonevu = Zonevu.init_from_std_keyfile()Security Best Practices
Never commit your zonevu_keyfile.json file to Git or other version control.
Limit access to your Windows user profile, as the file resides in your user directory.
Regenerate your API Key periodically based on Company policy.
Treat your API Key with the same sensitivity as your ZoneVu login credentials.
