Skip to content

Commit 4fdbcee

Browse files
author
Tony Bedford
committed
Use key+secret and fix parameters
1 parent 8b996cf commit 4fdbcee

File tree

5 files changed

+65
-15
lines changed

5 files changed

+65
-15
lines changed

application/create-application.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,26 @@
33
from pprint import pprint
44

55
client = nexmo.Client(
6-
application_id=APPLICATION_ID,
7-
private_key=APPLICATION_PRIVATE_KEY_PATH,
6+
key=NEXMO_API_KEY,
7+
secret=NEXMO_API_SECRET
88
)
99

1010
response = client.application_v2.create_application({
11-
name='Example App',
12-
type='voice'
11+
"name": "Code Example App",
12+
"capabilities": {
13+
"messages": {
14+
"webhooks": {
15+
"inbound_url": {
16+
"address": "https://example.com/webhooks/inbound",
17+
"http_method": "POST"
18+
},
19+
"status_url": {
20+
"address": "https://example.com/webhooks/status",
21+
"http_method": "POST"
22+
}
23+
}
24+
}
25+
}
1326
})
1427

1528
pprint(response)

application/delete-application.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
from pprint import pprint
44

55
client = nexmo.Client(
6-
application_id=APPLICATION_ID,
7-
private_key=APPLICATION_PRIVATE_KEY_PATH,
6+
key=NEXMO_API_KEY,
7+
secret=NEXMO_API_SECRET
88
)
99

10-
response = client.application_v2.delete_application(uuid)
10+
response = client.application_v2.delete_application(NEXMO_APPLICATION_ID)
1111

1212
pprint(response)

application/get-application.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
from pprint import pprint
44

55
client = nexmo.Client(
6-
application_id=APPLICATION_ID,
7-
private_key=APPLICATION_PRIVATE_KEY_PATH,
6+
key=NEXMO_API_KEY,
7+
secret=NEXMO_API_SECRET
88
)
99

10-
response = client.application_v2.get_application(uuid)
10+
response = client.application_v2.get_application(NEXMO_APPLICATION_ID)
1111

1212
pprint(response)

application/list-applications.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from pprint import pprint
44

55
client = nexmo.Client(
6-
application_id=APPLICATION_ID,
7-
private_key=APPLICATION_PRIVATE_KEY_PATH,
6+
key=NEXMO_API_KEY,
7+
secret=NEXMO_API_SECRET
88
)
99

1010
response = client.application_v2.list_applications()

application/update-application.py

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,47 @@
33
from pprint import pprint
44

55
client = nexmo.Client(
6-
application_id=APPLICATION_ID,
7-
private_key=APPLICATION_PRIVATE_KEY_PATH,
6+
key=NEXMO_API_KEY,
7+
secret=NEXMO_API_SECRET
88
)
99

10-
response = client.application_v2.update_application(uuid, answer_method='POST')
10+
response = client.application_v2.update_application(NEXMO_APPLICATION_ID, {
11+
"name": "Python Update App",
12+
"capabilities": {
13+
"messages": {
14+
"webhooks": {
15+
"inbound_url": {
16+
"address": "https://example.com/webhooks/inbound",
17+
"http_method": "POST"
18+
},
19+
"status_url": {
20+
"address": "https://example.com/webhooks/status",
21+
"http_method": "POST"
22+
}
23+
}
24+
},
25+
"voice": {
26+
"webhooks": {
27+
"answer_url": {
28+
"address": "https://example.com/webhooks/answer",
29+
"http_method": "POST"
30+
},
31+
"event_url": {
32+
"address": "https://example.com/webhooks/event",
33+
"http_method": "POST"
34+
}
35+
}
36+
},
37+
"rtc": {
38+
"webhooks": {
39+
"event_url": {
40+
"address": "https://example.com/webhooks/event",
41+
"http_method": "POST"
42+
}
43+
}
44+
},
45+
"vbc": {}
46+
}
47+
})
1148

1249
pprint(response)

0 commit comments

Comments
 (0)