Question 24 of 28 from exam 300-835-CLAUTO: Automating Cisco Collaboration Solutions

Question 24 of 28 from exam 300-835-CLAUTO: Automating Cisco Collaboration Solutions

Question

DRAG DROP -

Python Yesterday, 11:13

The bot says:

|!ama developer too!

Refer to the exhibit.

A developer has implemented ChatOps to a Webex Teams space as described in the exhibit.

The Python script that pushes the notifications to the Teams space is shown.

Drag and drop the code to complete the script.

Not all options are used.

Select and Place:

Answer Area

import requests, json, os

header % os.environ.get (“BOT_TOKEN’) ,

“Content-Type”: “application/json”}
message = “_The bot says: \n> I am a **developer** too!”

payload = {“roomId”: os.environ.get (“SPACE_ID’),
‘markdown”: message}

requests. request ( ,url="https: //api .ciscospark.com/v1/messages” ,

headers-header, data , verify-True)

if res. == 200:

print (“your message was successfully posted to Webex Teams’)
else:

print (‘failed with status code: %d” %res.status_code)

if res.status_code 404:

print (“please check the bot is in the space you’re attempting to post to...”)
elif res.status_code — 400:

print (“please check the identifier of the space you're attempting to post to...
elif res.status_code — 401:

print (“please check if the access token is correct...”)

json.dumps (payload) “PUT” status_code payload

“authentication” “authorization” “Bearer” status

“Bearer %s’" json (payload) “Post” code

Explanations

Answer Area

import requests, json, os

header “authorization” “Bearer” % os.environ.get (“BOT_TOKEN”) ,

“Content-Type”: “application/json”}
message = “_The bot says: \n> I am a **developer** too!”

payload = {“roomId”: os.environ.get (“SPACE_ID’),
‘markdown”: message}

requests. request ( “Post” , url="https: //api.ciscospark.com/v1/messages",|

headers-header, data= | json.dumps (payload) |, verify-True)

if res. status_code = 200:

print (“your message was successfully posted to Webex Teams’)
else:

print (‘failed with status code: %d” %res.status_code)

if res.status_code 404:

print (“please check the bot is in the space you’re attempting to post to...”)
elif res.status_code — 400:

print (“please check the identifier of the space you're attempting to post to...
elif res.status_code — 401:

print (“please check if the access token is correct...”)

json.dumps (payload) “PUT” status_code payload

“authentication” “authorization” “Bearer” status

“Bearer %s’" json (payload) “Post” code