Skip to main content

Vonage Account API package

Project description

Vonage Account Package

This package contains the code to use Vonage's Account API in Python.

It includes methods for managing Vonage accounts, managing account secrets and querying country pricing.

Usage

It is recommended to use this as part of the main vonage package. The examples below assume you've created an instance of the vonage.Vonage class called vonage_client.

Get Account Balance

balance = vonage_client.account.get_balance()
print(balance)

Top-Up Account

response = vonage_client.account.top_up(trx='1234567890')
print(response)

Get Service Pricing for a Specific Country

from vonage_account import GetCountryPricingRequest

response = vonage_client.account.get_country_pricing(
    GetCountryPricingRequest(type='sms', country_code='US')
)
print(response)

Get Service Pricing for All Countries

response = vonage_client.account.get_all_countries_pricing(service_type='sms')
print(response)

Get Service Pricing by Dialing Prefix

from vonage_account import GetPrefixPricingRequest

response = client.account.get_prefix_pricing(
    GetPrefixPricingRequest(prefix='44', type='sms')
)
print(response)

Update the Default SMS Webhook

This will return a Pydantic object (SettingsResponse) containing multiple settings for your account.

settings: SettingsResponse = vonage_client.account.update_default_sms_webhook(
    mo_callback_url='https://example.com/inbound_sms_webhook',
    dr_callback_url='https://example.com/delivery_receipt_webhook',
)

print(settings)

List Secrets Associated with the Account

response = vonage_client.account.list_secrets()
print(response)

Create a New Account Secret

secret = vonage_client.account.create_secret('Mytestsecret12345')
print(secret)

Get Information About One Secret

secret = vonage_client.account.get_secret(MY_SECRET_ID)
print(secret)

Revoke a Secret

Note: it isn't possible to revoke all account secrets, there must always be one valid secret. Attempting to do so will give a 403 error.

client.account.revoke_secret(MY_SECRET_ID)

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

vonage_account-1.1.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

vonage_account-1.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file vonage_account-1.1.0.tar.gz.

File metadata

  • Download URL: vonage_account-1.1.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.4

File hashes

Hashes for vonage_account-1.1.0.tar.gz
Algorithm Hash digest
SHA256 210409ac8c9441257aacea86189d6ed8e4345938dc9e9a5c10b436e962c148ad
MD5 186c2fb7a4354eff902236ae6defcb2c
BLAKE2b-256 e113658bd0330d89bbcc99a6f8373a09e64febea3a809133b82650061f2c055e

See more details on using hashes here.

File details

Details for the file vonage_account-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for vonage_account-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24e9a016d63cf1bf039533a43c5595ca502b0d204c5d8c5f13f5dff002793ba7
MD5 b7b35c14387ac81578fc6e7acff98e2c
BLAKE2b-256 a4026d462b9c06b1b45ab5d6455a9f0b38eeecafbdde347569394cda8a26e99b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page