nerdexam
Cisco

350-901 · Question #31

Refer to the exhibit. A developer is creating a python script to use the Webex Teams REST API to list joined spaces, retry after the server-specified amount of time if a "Too many requests" response i

Sign in or unlock 350-901 to reveal the answer and full explanation for question #31. The question stem and answer options stay visible for context.

Understanding and Using APIs

Question

Refer to the exhibit. A developer is creating a python script to use the Webex Teams REST API to list joined spaces, retry after the server-specified amount of time if a "Too many requests" response is received, and print any other error that is received. Drag and drop the code snippets from the left onto the item numbers on the right that match the missing sections in the exhibit to complete the script. Not all code snippets are used. Code Exhibit:
import requests
token = "BEARER_TOKEN_HERE"
url = 'https://api.ciscopark.com/v1/rooms'
headers = {'content-type': 'application/yang-data+json',
 'accept': 'application/yang-data+json',
 'Authorization':f'Bearer {token}'}

while True:
 response = requests.get(url, headers=headers, verify=False)
 status = <item 1>
 if (status == 200):
 print("Success")
 break
 elif(status == <item 2>):
 sleep_time = int(<item 3>)
 print(f'Too Many requests. Sleeping for {sleep_time}, <item 4>.)
 time.sleep(sleep_time)
 else:
 print("Error code" + str(status) + "detected.")
 break
Available Snippets from Answer Area: 429, RETRIES, backoff, backoff, i

Unlock 350-901 to see the answer

You've previewed enough free 350-901 questions. Unlock 350-901 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 Scripting#API Error Handling#HTTP Status Codes#API Retry Mechanisms
Full 350-901 Practice