Account
Account
The Account class is used to manage your Sonetel account information. You can use it to get information about your account such as the current prepaid balance, the account ID, and more.
You can also update your account information such as the company name, language, and timezone.
The class contains the following methods:
get()- Get information about the Sonetel account.update()- Update your account information.get_balance()- Get the current prepaid balance in the account.get_accountid()- Get your account ID.
Account
get()
Get information about the Sonetel account.
Examples:
>>> account = Account(access_token='your_access_token')
>>> acc_info = account.get()
>>> print(acc_info['response']['name'])
'ACME Inc.'
>>> print(acc_info['response']['currency'])
'USD'
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
The account information if the request was processed successfully. |
get_accountid()
Get your account ID. The account ID is used to uniquely identify your Sonetel account.
Examples:
>>> account = Account(access_token='your_access_token')
>>> print(account.get_accountid())
'123456789'
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The account ID. |
get_balance(currency=False)
Get the current prepaid balance in the account
Examples:
>>> account = Account(access_token='your_access_token')
>>> print(account.get_balance())
'1.23'
>>> print(account.get_balance(currency=True))
'1.23 USD'
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
currency |
bool
|
Optional. Set to true if currency should be returned in the response. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
A string representing the current prepaid balance in the Sonetel account. |
update(name='', language='', timezone='')
Update your account information. Pass one or more of the following parameters:
Examples:
>>> account = Account(access_token='your_access_token')
>>> acc_info = account.update(name='ACME Inc.', language='en', timezone='Europe/Stockholm')
>>> print(acc_info['response']['name'])
'ACME Inc.'
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
New company name. |
''
|
language |
str
|
The ID of the new language you want to switch to. Changes the language you see in app.sonetel.com |
''
|
timezone |
str
|
The ID of the new timezone you want to switch to. |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
The updated account information if the request was processed successfully. |