300-835 · Question #59
300-835 Question #59: Real Exam Question with Answer & Explanation
``python import requests img_encoded_b64 = "==" for i in range(1,51): url = "http://192.168.1.{}/putxml".format(i) payload = "<Command><UserInterface><Branding><Logo updateId=\"1\">" \ "<Upload><Branding></UserInterface></Command><body>" \ "{img_encoded_b64}".format(img_encoded_b
Question
A developer for a large company must change the logo on all Cisco collaboration room devices and a base64 image has already been provided. Drag and drop the code snippets from the bottom onto the boxes in the Python script to update the logo on devices in the 192.168.1.1 to 192.168.1.50 IP range by using the xAPI. Not all options are used.
Explanation
import requests
img_encoded_b64 = "=="
for i in range(1,51):
url = "http://192.168.1.{}/putxml".format(i)
payload = "<Command><UserInterface><Branding><Logo updateId=\"1\">" \
"<Upload><Branding></UserInterface></Command><body>" \
"{img_encoded_b64}".format(img_encoded_b64=img_encoded_b64)
headers = {
'Content-Type': 'text/xml',
'Authorization': 'Basic cyadufuvpoloycytfadzrqtuw='
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
The loop iterates through IP addresses from 192.168.1.1 to 192.168.1.50. The /putxml endpoint is used to issue xAPI commands to Cisco devices. The <Branding> tag indicates the update is for the device's branding/logo. The Authorization header uses Basic authentication. The request method to send the XML payload is POST.
Topics
Community Discussion
No community discussion yet for this question.