DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1
FeedbackSlot: <1..4> ServerUrl(r): <S: 1, 2048>
Format: <XML/JSON>
Expression: <S: 1, 255> Expression: <S: 1, 255>
Expression: <S: 1, 255>
Expression: <S: 1, 255> Expression: <S: 1, 255>
Expression: <S: 1, 255>
Expression: <S: 1, 255> Expression: <S: 1, 255>
Expression: <S: 1, 255>
Expression: <S: 1, 255> Expression: <S: 1, 255>
Expression: <S: 1, 255>
Expression: <S: 1, 255> Expression: <S: 1, 255>
Expression: <S: 1, 255>

Example 10-22 shows a simple Python POST to register a
webhook.


Example 10-22 Python Script to Set a Webhook to
Receive Event Notifications


Click here to view code image


""" Webex Devices - Set Webhook """
import requests
URL = "http://10.10.20.159/put.xml"
PAYLOAD = (
'<Command>' +
' <HttpFeedback>' +
' <Register command="True">' +
' <FeedbackSlot>1</FeedbackSlot>' +
' <ServerUrl>http://127.0.0.1/devasc-
webhook</ServerUrl>' +
' <Format>JSON</Format>' +
' <Expression
item="1">/Configuration</Expression>' +
' <Expression
item="2">/Event/CallDisconnect</Expression>' +
' <Expression
item="3">/Status/Call</Expression>' +
' </Register>' +
' </HttpFeedback>' +
'</Command>'
)
HEADERS = {
'Content-Type': "application/xml",
'Cookie':
"SessionId=c6ca2fc23d3f211e0517d4c603fbe4205c77d13dd6913c7bc12eef4

085b7637b,SessionId=c6ca2fc23d3f211e0517d4c603fbe4205c77d13dd6913c7bc12eef40
Free download pdf