nerdexam
Cisco

300-435 · Question #116

Refer to the exhibit. An engineer is experiencing issues with their Cisco SDWAN vManage script. Error handling must be added in the script to raise Python exceptions when the HTTP status code is not o

Sign in or unlock 300-435 to reveal the answer and full explanation for question #116. The question stem and answer options stay visible for context.

Controller-Based Network Automation

Question

Refer to the exhibit. An engineer is experiencing issues with their Cisco SDWAN vManage script. Error handling must be added in the script to raise Python exceptions when the HTTP status code is not ok (4xx or 5xx). Which code snippet must be added to the box in the code to perform this task?
import requests

vmanage_host = "sandbox-sdwan-1.cisco.com"
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2ODMxMzYyNTQsImV4cCI6MTY4MzEzOTg1NCwiaXNzIjoic2FuZGJveC1zZHdhbi0xLmNpc2NvLmNvbSIsImp0aSI6ImZhMWQ4MDViMi03MzI1LTQzYWItYjFhZi0wMjAwMDlmMjgyMjYifQ.F3DD134D93C1C2F29F8F8F43AF7F422F0"
session_id = "NTYzNmU3ZDJiMjAzMDQ2N2FkNzcxMDQzNzEyYTFhNGU4MjAxMTA4MzBiNTMxMmFjMDcxODUzNzIyNzE5MjQ0MzU4"

url = f"https://{vmanage_host}/dataservice/system/device/management/systemip"
headers = {
 "Content-Type": "application/json",
 "X-XSRF-TOKEN": token,
 "Cookie": f"JSESSIONID={session_id}",
}

# MISSING LINE HERE

print(response.json())

Exhibit

300-435 question #116 exhibit

Options

  • Arequests.raise_for_status()
  • Bresponse.raise_for_status()
  • Cresponse.status_code
  • Drequests.codes.ok

Unlock 300-435 to see the answer

You've previewed enough free 300-435 questions. Unlock 300-435 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Topics

#Python#requests library#Error Handling#HTTP Status Codes
Full 300-435 Practice