Skip to content

Commit cc09093

Browse files
committed
A few more webexteamssdk additions
1 parent 39b5f58 commit cc09093

7 files changed

Lines changed: 18 additions & 19 deletions

File tree

intro-cmx/cmx-04-mission/cmxnotificationreceiver.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import datetime
3535
import os
3636
import re
37-
import ciscosparkapi
37+
import webexteamsapi
3838
from pprint import pprint
3939
from flask import Flask
4040
from flask import json
@@ -66,8 +66,7 @@ def create_notification(msg):
6666
global username
6767
global password
6868

69-
# MISSION TODO
70-
endpoint = "https://" + url + "CMX API ENDPOINT TO CREATE NOTIFICATIONS"
69+
endpoint = "https://" + url + "/api/config/v1/notification"
7170

7271
payload = \
7372
{
@@ -77,7 +76,7 @@ def create_notification(msg):
7776
{
7877
"conditions":[
7978
{
80-
"condition": "locationupdate.macAddressList == MAC ADDRESS TO BE FOUND;"
79+
"condition": "locationupdate.macAddressList == 00:00:2a:01:00:4e;"
8180
}
8281
]
8382
}
@@ -102,7 +101,7 @@ def create_notification(msg):
102101
"macScramblingSalt": "learning",
103102
"notificationType": "LocationUpdate"
104103
}
105-
# END MISSION TODO
104+
106105
headers = {"Content-Type": "application/json"}
107106

108107
print(json.dumps(payload))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ciscosparkapi==0.9.2
1+
webexteamsapi
22
requests==2.18.4
33
requests-toolbelt==0.8.0
44
Flask==0.12.2

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
ciscosparkapi==0.9.2
1+
webexteamssdk
22
ncclient==0.6.0
33
netmiko==1.4.2
44
pyang==1.7.4
55
requests==2.20.0
66
urllib3==1.24.2
77
xmltodict==0.11.0
88
ansible==2.5.4
9-
PrettyTable==0.7.2
9+
PrettyTable==0.7.2

verify/backend/cmx.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
55
6-
Copyright (c) 2018 Cisco and/or its affiliates.
6+
Copyright (c) 2018-2021 Cisco and/or its affiliates.
77
88
Permission is hereby granted, free of charge, to any person obtaining a copy
99
of this software and associated documentation files (the "Software"), to deal
@@ -33,7 +33,7 @@ def verify() -> bool:
3333

3434

3535

36-
# Verify the Spark Room exists and is accessible via the access token
36+
# Verify the Webex Room exists and is accessible via the access token
3737
try:
3838
r = requests.get(
3939
"https://cmxlocationsandbox.cisco.com/api/location/v2/clients",

verify/backend/meraki.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
55
6-
Copyright (c) 2018 Cisco and/or its affiliates.
6+
Copyright (c) 2018-2021 Cisco and/or its affiliates.
77
88
Permission is hereby granted, free of charge, to any person obtaining a copy
99
of this software and associated documentation files (the "Software"), to deal
@@ -32,7 +32,7 @@ def verify() -> bool:
3232

3333

3434

35-
# Verify the Spark Room exists and is accessible via the access token
35+
# Verify the Webex Room exists and is accessible via the access token
3636
try:
3737
r = requests.get(
3838
"https://api.meraki.com/api/v0/organizations",
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import os
3232
import sys
3333

34-
import ciscosparkapi
34+
import webexteamssdk
3535

3636

3737
# Get the absolute path for the directory where this file is located "here"
@@ -60,14 +60,14 @@ def verify() -> bool:
6060
)
6161
return False
6262

63-
spark = ciscosparkapi.CiscoSparkAPI(
63+
webexapi = webexteamssdk.WebexTeamsAPI(
6464
access_token=env_user.WEBEX_ACCESS_TOKEN
6565
)
6666

6767
# Verify the Cisco Webex APIs are accessible and responding
6868
try:
69-
me = spark.people.me()
70-
except ciscosparkapi.SparkApiError as e:
69+
me = webexapi.people.me()
70+
except webexapi.WebexApiError as e:
7171
print(
7272
"\nFAILED: The API call to Cisco Webex returned the following "
7373
"error:\n{}\n".format(e)
@@ -89,8 +89,8 @@ def verify() -> bool:
8989

9090
# Verify the Webex Room exists and is accessible via the access token
9191
try:
92-
room = spark.rooms.get(env_user.WEBEX_ROOM_ID)
93-
except ciscosparkapi.SparkApiError as e:
92+
room = webexapi.rooms.get(env_user.WEBEX_ROOM_ID)
93+
except webexapi.WebexApiError as e:
9494
print(
9595
"\nFAILED: There was an error accessing the Webex Room using the "
9696
"WEBEX_ROOM_ID you provided; error details:\n{}\n".format(e)

verify/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ciscosparkapi==0.9.2
1+
webexteamsapi
22
ncclient==0.6.2
33
netmiko==1.4.2
44
requests==2.18.4

0 commit comments

Comments
 (0)