|
14 | 14 | args = vars(parser.parse_args()) |
15 | 15 |
|
16 | 16 | try: |
17 | | - # Create a MessageBird client with the specified accessKey. |
18 | | - client = messagebird.Client(args['accessKey']) |
19 | | - |
20 | | - # Update number |
21 | | - # Note: at the moment, we only support updating tags that can be used to group or label numbers |
22 | | - tags = ['tag1'] |
23 | | - number = client.update_number('3197010240126', tags) |
24 | | - |
25 | | - # Print the object information. |
26 | | - print('\nThe following information was returned as a Number object:\n') |
27 | | - print(' number : %s' % number.number) |
28 | | - print(' country : %s' % number.country) |
29 | | - print(' region : %s' % number.region) |
30 | | - print(' locality : %s' % number.locality) |
31 | | - print(' features : %s' % number.features) |
32 | | - print(' tags : %s' % number.tags) |
33 | | - print(' type : %s' % number.type) |
34 | | - print(' status : %s' % number.status) |
| 17 | + # Create a MessageBird client with the specified accessKey. |
| 18 | + client = messagebird.Client(args['accessKey']) |
| 19 | + |
| 20 | + # Update number |
| 21 | + # Note: at the moment, we only support updating tags that can be used to group or label numbers |
| 22 | + tags = ['tag1'] |
| 23 | + number = client.update_number('3197010240126', tags) |
| 24 | + |
| 25 | + # Print the object information. |
| 26 | + print('\nThe following information was returned as a Number object:\n') |
| 27 | + print(' number : %s' % number.number) |
| 28 | + print(' country : %s' % number.country) |
| 29 | + print(' region : %s' % number.region) |
| 30 | + print(' locality : %s' % number.locality) |
| 31 | + print(' features : %s' % number.features) |
| 32 | + print(' tags : %s' % number.tags) |
| 33 | + print(' type : %s' % number.type) |
| 34 | + print(' status : %s' % number.status) |
35 | 35 |
|
36 | 36 | except messagebird.client.ErrorException as e: |
37 | | - print('\nAn error occured while requesting a NumberList object:\n') |
| 37 | + print('\nAn error occured while requesting a NumberList object:\n') |
38 | 38 |
|
39 | | - for error in e.errors: |
40 | | - print(' code : %d' % error.code) |
41 | | - print(' description : %s' % error.description) |
42 | | - print(' parameter : %s\n' % error.parameter) |
| 39 | + for error in e.errors: |
| 40 | + print(' code : %d' % error.code) |
| 41 | + print(' description : %s' % error.description) |
| 42 | + print(' parameter : %s\n' % error.parameter) |
43 | 43 |
|
44 | 44 | except requests.exceptions.HTTPError as e: |
45 | 45 | print('\nAn HTTP exception occurred while fetching all purchased phone numbers:') |
|
0 commit comments