Vhi Python Client
A Python client library for interacting dynamically with the Vhi API. Provides automated handling of Session state, Multi-Factor Authentication (MFA) callbacks, Claims Retrieval, and memory-efficient Document Downloads.
Installation
You can install the library directly from source (or via pip once published):
pip install vhi-python
Alternatively, to install it locally for development:
git clone https://github.com/agent/vhi-python.git
cd vhi-python
pip install -e .
Quick Start Example
This example demonstrates how to use the library to log in, handle an MFA callback (simulated via CLI input), retrieve claims, and download a claim PDF.
import os
from vhi.client import VhiClient
from vhi.exceptions import VhiAuthenticationError, VhiApiError
def my_cli_mfa_callback() -> str:
"""
A simple callback function that pauses execution
and waits for the user to input the 2FA code sent to their phone/email.
"""
return input("Vhi 2FA Code Required. Enter OTP: ").strip()
def main():
# 1. Initialize the client
# Replace with your actual credentials
username = os.getenv("VHI_USERNAME", "your_email@example.com")
password = os.getenv("VHI_PASSWORD", "your_password")
# We pass our callback function so the client can automatically
# pause and invoke it if the server demands MFA.
client = VhiClient(
username=username,
password=password,
mfa_callback=my_cli_mfa_callback
)
try:
# 2. Login
print("Logging in...")
client.login()
print("Login successful!")
# 3. Retrieve Claims
print("\nRetrieving claims...")
statements = client.get_claims()
if not statements:
print("No claim statements found.")
return
for claim in statements:
print(f"- Claim {claim.claim_id} | Date: {claim.date_of_service} | Status: {claim.status}")
# 4. Download a Document
# We will download the first available document as an example
first_claim = statements[0]
if first_claim.document_id:
download_path = f"{first_claim.claim_id}.pdf"
print(f"\nDownloading document {first_claim.document_id} to {download_path}...")
client.download_document(first_claim.document_id, download_path)
print("Download complete!")
except VhiAuthenticationError as e:
print(f"Authentication failed: {e}")
except VhiApiError as e:
print(f"API Error occurred: {e}")
if __name__ == "__main__":
main()
Error Handling
The library provides structural custom exceptions:
VhiAuthenticationError: Raised when login fails due to invalid credentials.VhiMfaRequiredError: Raised when the server requests MFA but you didn't provide a callback, or when the callback returns an invalid OTP.VhiApiError: Raised for any other 4xx or 5xx API errors. Contains standard HTTP status codes for debugging.
Metadata
Release files for vhi-python 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vhi_python-0.1.7.tar.gz | 9.0 kB | With provenance | Details for vhi_python-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vhi_python-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for vhi_python-0.1.7-py3-none-any.whl |
Total release size: 16.3 kB
Release files / vhi_python-0.1.7.tar.gz
| Download URL | vhi_python-0.1.7.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1776a1d4ff2b9d8e51a7da4e0a3c4080f7bc868ea3f9f08dc3b8c83c93456fbf
|
|
BLAKE2b-256 checksum How to use checksums |
7f1af22e96bac7da15c4a373d6fc7dfb0f69500c491dfda8e75ff4a8a32feb95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 19, 2026.
Transparency logRelease files / vhi_python-0.1.7-py3-none-any.whl
| Download URL | vhi_python-0.1.7-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb3de4b7c5aede4d0c06a3b16fe165dbb29f07ecd2b0d64c79ab3ab8a9aab1b6
|
|
BLAKE2b-256 checksum How to use checksums |
fcd58c273b5fed9ab74a2433d4f364b4a5e17bbce4d70436a00882fd37230d6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 19, 2026.
Transparency logSecurity for vhi-python 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for vhi_python-0.1.7.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.