This directory contains practical examples demonstrating how to use HedgeBuddy in your Python scripts.
Since HedgeBuddy is designed for standalone scripts, install it globally so it's available to all your scripts:
pip install --user hedgebuddypython -c "import hedgebuddy; print('HedgeBuddy installed successfully!')"Make sure you have:
- Installed HedgeBuddy globally (see above)
- Installed the HedgeBuddy desktop app
- Configured at least one variable (e.g.,
API_KEY) using the app
Then run any example:
python examples/basic_usage.py
python examples/real_world_example.py
python examples/legacy_migration.py
python examples/error_handling.pyCore functions: var(), defaults, exists(), all_vars().
Required variables: API_KEY
Daily log files with enable_logging(), automatic print() capture, direct logging helpers, log rotation (30 days).
Required variables: API_KEY (for demo)
Report generation workflow: API fetch, local save, optional S3 upload and email.
Required variables: REPORT_PATH | Optional: S3_BUCKET, REPORT_EMAIL, API_URL
Two migration approaches: inject_env() for minimal changes, var() for new code.
Required variables: API_KEY
Exception handling, graceful degradation, value validation, conditional features.
Required variables: None