Skip to content

Commit 39c81a7

Browse files
Serge KamelSerge Kamel
authored andcommitted
chore: get accessKey as an cli argument.
1 parent 8f4b084 commit 39c81a7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

examples/voice_messages_list.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
#!/usr/bin/env python
22

3+
import argparse
34
import messagebird
45
import sys
56
import os
67
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
78

89

9-
# ACCESS_KEY = ''
10+
parser = argparse.ArgumentParser()
11+
parser.add_argument(
12+
'--accessKey', help='access key for MessageBird API', type=str, required=True)
13+
14+
args = vars(parser.parse_args())
1015

1116
try:
12-
# Create a MessageBird client with the specified ACCESS_KEY.
13-
client = messagebird.Client(ACCESS_KEY)
17+
client = messagebird.Client(args['accessKey'])
1418

1519
# Fetch Voice Messages List from a specific offset, and within a defined limit.
1620
voiceMessageList = client.voice_message_list(limit=10, offset=0)

0 commit comments

Comments
 (0)