File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434import datetime
3535import os
3636import re
37- import ciscosparkapi
37+ import webexteamsapi
3838from pprint import pprint
3939from flask import Flask
4040from 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 ))
Original file line number Diff line number Diff line change 1- ciscosparkapi == 0.9.2
1+ webexteamsapi
22requests == 2.18.4
33requests-toolbelt == 0.8.0
44Flask == 0.12.2
Original file line number Diff line number Diff line change 1- ciscosparkapi == 0.9.2
1+ webexteamssdk
22ncclient == 0.6.0
33netmiko == 1.4.2
44pyang == 1.7.4
55requests == 2.20.0
66urllib3 == 1.24.2
77xmltodict == 0.11.0
88ansible == 2.5.4
9- PrettyTable == 0.7.2
9+ PrettyTable == 0.7.2
Original file line number Diff line number Diff line change 33
44
55
6- Copyright (c) 2018 Cisco and/or its affiliates.
6+ Copyright (c) 2018-2021 Cisco and/or its affiliates.
77
88Permission is hereby granted, free of charge, to any person obtaining a copy
99of 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" ,
Original file line number Diff line number Diff line change 33
44
55
6- Copyright (c) 2018 Cisco and/or its affiliates.
6+ Copyright (c) 2018-2021 Cisco and/or its affiliates.
77
88Permission is hereby granted, free of charge, to any person obtaining a copy
99of 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" ,
Original file line number Diff line number Diff line change 3131import os
3232import 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 "\n FAILED: 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 "\n FAILED: There was an error accessing the Webex Room using the "
9696 "WEBEX_ROOM_ID you provided; error details:\n {}\n " .format (e )
Original file line number Diff line number Diff line change 1- ciscosparkapi == 0.9.2
1+ webexteamsapi
22ncclient == 0.6.2
33netmiko == 1.4.2
44requests == 2.18.4
You can’t perform that action at this time.
0 commit comments