forked from messagebird/python-rest-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbalance.py
More file actions
29 lines (21 loc) · 870 Bytes
/
Copy pathbalance.py
File metadata and controls
29 lines (21 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import messagebird
ACCESS_KEY = 'test_gshuPaZoeEG6ovbc8M79w0QyM'
try:
# Create a MessageBird client with the specified ACCESS_KEY.
client = messagebird.Client(ACCESS_KEY)
# Fetch the Balance object.
balance = client.balance()
# Print the object information.
print('\nThe following information was returned as a Balance object:\n')
print(' amount : %d' % balance.amount)
print(' type : %s' % balance.type)
print(' payment : %s\n' % balance.payment)
except messagebird.client.ErrorException as e:
print('\nAn error occured while requesting a Balance object:\n')
for error in e.errors:
print(' code : %d' % error.code)
print(' description : %s' % error.description)
print(' parameter : %s\n' % error.parameter)