200-901 · Question #56
FILL BLANK Fill in the blanks to complete the Python script to retrieve a list of network devices using the Cisco DNA Center API. my_token= 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzl1NiJ9.ey.JzdWloOil1ZDE0OWZkM
The correct answer is A. "GET", url, headers = headers, data = payload. The Python requests library requires the HTTP method, URL, headers, and data payload as arguments to requests.request(), and a GET call with the x-auth-token header is the correct way to retrieve network devices from the Cisco DNA Center API.
Question
Options
- A"GET", url, headers = headers, data = payload
How the community answered
(21 responses)- A100% (21)
Why each option
The Python requests library requires the HTTP method, URL, headers, and data payload as arguments to requests.request(), and a GET call with the x-auth-token header is the correct way to retrieve network devices from the Cisco DNA Center API.
The requests.request() function signature requires the method as the first positional argument ("GET" for a read operation), followed by the URL, then keyword arguments for headers and data. Using headers=headers passes the dictionary containing the 'x-auth-token' JWT for authentication, and data=payload passes the empty payload dict, which is correct for a GET request to the Cisco DNA Center network-device endpoint.
Concept tested: Cisco DNA Center REST API call using Python requests
Source: https://developer.cisco.com/docs/dna-center/#!cisco-dna-center-platform-overview
Topics
Community Discussion
No community discussion yet for this question.