Install & Compatibility
Where this runs
tested against v1.0.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 48.1MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 4.8s · import 0.000s · 48MB
47MB installed
● package 47MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Subaccounts
✓ from vonage_subaccounts import Subaccounts
✗ from vonage_subaccounts import VonageSubaccounts
Subaccount
✓ from vonage_subaccounts import Subaccount
VonageAccount
✓ from vonage_subaccounts import VonageAccount
This quickstart demonstrates how to initialize the Vonage client and then the Subaccounts client to list existing subaccounts. It requires your Vonage API Key and Secret, preferably from environment variables.
import os
from vonage import Client
from vonage_subaccounts import VonageSubaccounts
# Ensure API_KEY and API_SECRET are set as environment variables
# e.g., export VONAGE_API_KEY='YOUR_API_KEY'
# e.g., export VONAGE_API_SECRET='YOUR_API_SECRET'
api_key = os.environ.get("VONAGE_API_KEY", "YOUR_API_KEY")
api_secret = os.environ.get("VONAGE_API_SECRET", "YOUR_API_SECRET")
if not api_key or api_key == "YOUR_API_KEY" or not api_secret or api_secret == "YOUR_API_SECRET":
print("Please set VONAGE_API_KEY and VONAGE_API_SECRET environment variables or replace placeholders.")
exit(1)
# Initialize the core Vonage client
vonage_client = Client(key=api_key, secret=api_secret)
# Initialize the Vonage Subaccounts client
subaccounts_client = VonageSubaccounts(client=vonage_client)
try:
# Example: List all subaccounts
print("Listing all subaccounts:")
all_subaccounts = subaccounts_client.get_all_subaccounts()
for subaccount in all_subaccounts:
print(f"- ID: {subaccount.get('id')}, Name: {subaccount.get('name')}, Balance: {subaccount.get('balance')}")
# Example: Create a new subaccount (uncomment to run)
# print("\nCreating a new subaccount...")
# new_subaccount = subaccounts_client.create_subaccount(name="My Test Subaccount via API")
# print(f"Created subaccount ID: {new_subaccount.get('id')}, Name: {new_subaccount.get('name')}")
except Exception as e:
print(f"An error occurred: {e}")
# Common errors might include authentication issues, invalid parameters, or API rate limits.
Debug
Known issues
gotchaThis library wraps the core `vonage` Python client. You *must* initialize `vonage.Client` first and pass it to `VonageSubaccounts`.fixEnsure `vonage.Client(key=..., secret=...)` is created and then `VonageSubaccounts(client=vonage_client)` is called.
affects: All versions
breakingAs this library is a wrapper for the Vonage API, changes in the underlying Vonage API or the `vonage` Python client (major versions) might introduce breaking changes to how requests are made or responses are structured.fixRefer to the release notes of the `vonage` library and the Vonage Subaccounts API documentation for migration guides.
affects: Depends on `vonage` client and Vonage API versions.
gotchaAPI Key and Secret must be for the *primary* account to manage subaccounts. Using subaccount credentials will result in permission errors for subaccount management operations.fixUse your master Vonage API Key and Secret when initializing the `vonage.Client`.
affects: All versions
Upgrade
Version history
1.0.4latest on PyPI · released Nov 6, 2024
Audit
Dependencies
vonagerequiredCore Vonage API client required for authentication and underlying HTTP requests.