Skip to content

Commit d3fd626

Browse files
New string formatting for example code
1 parent beb9130 commit d3fd626

5 files changed

+40
-37
lines changed

examples/voice_create_webhook.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@
1818

1919
# Print the object information.
2020
print('\nThe following information was returned as a Voice Webhook object:\n')
21-
print(' id : %s' % webhook.id)
22-
print(' token : %s' % webhook.token)
23-
print(' url : %s' % webhook.url)
24-
print(' createdAtDatetime : %s' % webhook.createdDatetime)
25-
print(' updatedAtDatetime : %s' % webhook.updatedDatetime)
21+
print(' id : {}'.format(webhook.id))
22+
print(' token : {}'.format(webhook.token))
23+
print(' url : {}'.format(webhook.url))
24+
print(' createdAtDatetime : {}'.format(webhook.createdDatetime))
25+
print(' updatedAtDatetime : {}'.format(webhook.updatedDatetime))
2626

2727
except messagebird.client.ErrorException as e:
2828
print('An error occured while creating a Voice Webhook object:')
2929

3030
for error in e.errors:
31-
print(' code : %d' % error.code)
32-
print(' description : %s' % error.description)
33-
print(' parameter : %s\n' % error.parameter)
31+
print(' code : {}'.format(error.code))
32+
print(' description : {}'.format(error.description))
33+
print(' parameter : {}\n'.format(error.parameter))
3434

3535

3636

examples/voice_delete_webhook.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
print('An error occured while deleting a Voice Webhook object:')
2020

2121
for error in e.errors:
22-
print(' code : %d' % error.code)
23-
print(' description : %s' % error.description)
24-
print(' parameter : %s\n' % error.parameter)
22+
print(' code : {}'.format(error.code))
23+
print(' description : {}'.format(error.description))
24+
print(' parameter : {}\n'.format(error.parameter))

examples/voice_list_webhook.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,22 @@
1616
if webhooks_list is None or webhooks_list.data is None:
1717
print("\nNo webhooks\n")
1818
exit(0)
19+
1920
# Print the object information.
2021
print('\nThe following information was returned as a Voice Webhook objects:\n')
2122
for webhook in webhooks_list.data:
2223
print('{')
23-
print(' id : %s' % webhook.id)
24-
print(' token : %s' % webhook.token)
25-
print(' url : %s' % webhook.url)
26-
print(' createdAtDatetime : %s' % webhook.createdDatetime)
27-
print(' updatedAtDatetime : %s' % webhook.updatedDatetime)
24+
print(' id : {}'.format(webhook.id))
25+
print(' token : {}'.format(webhook.token))
26+
print(' url : {}'.format(webhook.url))
27+
print(' createdAtDatetime : {}'.format(webhook.createdDatetime))
28+
print(' updatedAtDatetime : {}'.format(webhook.updatedDatetime))
2829
print('}\n')
2930

3031
except messagebird.client.ErrorException as e:
3132
print('An error occured while reading a Voice Webhook object:')
3233

3334
for error in e.errors:
34-
print(' code : %d' % error.code)
35-
print(' description : %s' % error.description)
36-
print(' parameter : %s\n' % error.parameter)
35+
print(' code : {}'.format(error.code))
36+
print(' description : {}'.format(error.description))
37+
print(' parameter : {}\n'.format(error.parameter))

examples/voice_read_webhook.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@
1616

1717
# Print the object information.
1818
print('\nThe following information was returned as a Voice Webhook object:\n')
19-
print(' id : %s' % webhook.id)
20-
print(' token : %s' % webhook.token)
21-
print(' url : %s' % webhook.url)
22-
print(' createdAtDatetime : %s' % webhook.createdDatetime)
23-
print(' updatedAtDatetime : %s' % webhook.updatedDatetime)
19+
20+
print(' id : {}'.format(webhook.id))
21+
print(' token : {}'.format(webhook.token))
22+
print(' url : {}'.format(webhook.url))
23+
print(' createdAtDatetime : {}'.format(webhook.createdDatetime))
24+
print(' updatedAtDatetime : {}'.format(webhook.updatedDatetime))
25+
2426

2527
except messagebird.client.ErrorException as e:
2628
print('An error occured while reading a Voice Webhook object:')
2729

2830
for error in e.errors:
29-
print(' code : %d' % error.code)
30-
print(' description : %s' % error.description)
31-
print(' parameter : %s\n' % error.parameter)
31+
print(' code : {}'.format(error.code))
32+
print(' description : {}'.format(error.description))
33+
print(' parameter : {}\n'.format(error.parameter))

examples/voice_update_webhook.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@
1414
try:
1515
client = messagebird.Client(args['accessKey'])
1616

17-
create_webhook_request = VoiceUpdateWebhookRequest(title=args['title'], token=args['token'])
18-
webhook = client.voice_update_webhook(args['webhookId'], create_webhook_request)
17+
update_webhook_request = VoiceUpdateWebhookRequest(title=args['title'], token=args['token'])
18+
webhook = client.voice_update_webhook(args['webhookId'], update_webhook_request)
1919

2020
# Print the object information.
2121
print('\nThe following information was returned as a Voice Webhook object:\n')
22-
print(' id : %s' % webhook.id)
23-
print(' token : %s' % webhook.token)
24-
print(' url : %s' % webhook.url)
25-
print(' createdAtDatetime : %s' % webhook.createdDatetime)
26-
print(' updatedAtDatetime : %s' % webhook.updatedDatetime)
22+
print(' id : {}'.format(webhook.id))
23+
print(' token : {}'.format(webhook.token))
24+
print(' url : {}'.format(webhook.url))
25+
print(' createdAtDatetime : {}'.format(webhook.createdDatetime))
26+
print(' updatedAtDatetime : {}'.format(webhook.updatedDatetime))
2727

2828
except messagebird.client.ErrorException as e:
2929
print('An error occured while updating a Voice Webhook object:')
3030

3131
for error in e.errors:
32-
print(' code : %d' % error.code)
33-
print(' description : %s' % error.description)
34-
print(' parameter : %s\n' % error.parameter)
32+
print(' code : {}'.format(error.code))
33+
print(' description : {}'.format(error.description))
34+
print(' parameter : {}\n'.format(error.parameter))
3535

3636

3737

0 commit comments

Comments
 (0)