Skip to content

Adding classes for more APIs, Client class now instantiates API classes so methods can be called consistently

Compare
Choose a tag to compare
@maxkahan maxkahan released this 26 May 15:54
ab38801
  • Moved some client methods into their own classes: account.py, application.py, message_search.py, number_insight.py, numbers.py, short_codes.py, ussd.py
  • Deprecated the corresponding client methods. These will be removed in a major release that's coming soon.
  • Client now instantiates a class object for each API when it is created, e.g. vonage.Client(key="mykey", secret="mysecret")
    instantiates instances of Account, Sms, NumberInsight etc. These instances can now be called directly from Client, e.g.
client = vonage.Client(key="mykey", secret="mysecret")

print(f"Account balance is: {client.account.get_balance()}")

print("Sending an SMS")
client.sms.send_message(
    "from": "Vonage",
    "to": "SOME_PHONE_NUMBER",
    "text": "Hello from Vonage's SMS API"
)