import requests
from requests.auth import HTTPBasicAuth
def get_auth_token():
url = 'https://sandboxdnac.cisco.com/dna/system/api/v1/auth/token'
resp = requests.post(url, auth=HTTPBasicAuth("devnetuser", "Cisco123!"))
token = resp.json()['Token']
print(token)
return token
I think it is D, as the print out is:
eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiI1ZTlkYmI3NzdjZDQ3ZTAwNGM2N2RkMGUiLCJhdXRoU291cmNlIjoiaW50ZXJuYWwiLCJ0ZW5hbnROYW1lIjoiVE5UMCIsInJvbGVzIjpbIjVkYzQ0NGQ1MTQ4NWM1MDA0YzBmYjIxMiJdLCJ0ZW5hbnRJZCI6IjVkYzQ0NGQzMTQ4NWM1MDA0YzBmYjIwYiIsImV4cCI6MTU5NDMwNjI0OSwiaWF0IjoxNTk0MzAyNjQ5LCJqdGkiOiIwY2Q5YjQyYy1iNWU2LTQ5ZTEtODVjZC1mZWI2MWY2NjQ5ZjYiLCJ1c2VybmFtZSI6ImRldm5ldHVzZXIifQ.OZk5uvMSmC2wG7AIXND_0FNdxTRgpXwiVnO2Vi4eM3uoGV28zYV4da12kchBKvqO9Rkc3SYppCzZXK_bVZ7jObKkWN6SBF_KFUo3avoFee-XCgzznTd2NBBoyu_0fyBinWwF_NX3tIQRX4TMgHdvKtKBVeYPAtSE-qHDUGVLAA7VoWuDipE-ktvo4BigYfSptXxTRtTOa1_vTsrwQ0PGiLWNzKA6ruBiCb8i_Tgo7x93MUp0tNy5866Fn51Ix8lcIhW1D0eRCTOZNe-J2e0QYNrAV1Xtv3zpS1p75joEq0kpdjon7NB6lGjFeUV_vGR9IXTQVhKY6KDan7SgCpMvUQ
Its the D
seach here (ctrl + f ) for : will return an Authorization Token
The cisco page says that return authorization token , so de discustion over authorization and authentication is ended . and also its super obvios that return a token.
https://developer.cisco.com/site/dnac-101/
C. It reads a token from a local JSON file and posts the token to the DNAC URL.
The Python function in the exhibit appears to read a token from a local JSON file by calling the json.load() function and passing in the file name as an argument. Then it makes a POST request to a specific URL using the requests.post() function and passing in the URL, the token and headers as arguments. The script also sets verify=False in the post method which could indicate that it is skipping SSL/TLS verification.
Given the context of the question (DNAC) and the parameters passed to the post method, it can be inferred that the script is likely interacting with the Cisco DNA Center (DNAC) API and the token read from the local JSON file is an authentication token that the script is using to authenticate to the DNAC API.
Option A, "It returns HTTP Basic Authentication," is incorrect. While the function does use HTTP Basic Authentication to authenticate the request, it does not return the authentication itself. Option B, "It returns DNAC user and password," is also incorrect. The function does not return the DNAC_USER and DNAC_PASSWORD variables. Option C, "It reads a token from a local JSON file and posts the token to the DNAC URL," is also incorrect. The function does not read a token from a local JSON file and does not post a token to the DNAC URL. Instead, it makes an HTTP POST request to the DNAC URL and parses the response from the server as JSON.
This section is not available anymore. Please use the main Exam Page.200-901 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Requium
Highly Voted 4 years, 5 months agoxXAzazelXx
Highly Voted 4 years, 4 months agojulian_1306
Most Recent 1 year, 5 months agoaniket2610
1 year, 6 months agoPelau_the_Engineer
1 year, 10 months agoherrmann69
10 months, 1 week agomellohello
1 year, 11 months agomacxsz
2 years, 6 months agokibo_muc
2 years, 7 months agosds85
2 years, 9 months agosds85
2 years, 9 months agoIam_someone
2 years, 7 months agodesignated
2 years, 9 months agoparkjunsung
2 years, 9 months agoErnick
2 years, 11 months agodem159
3 years agoCaptainPirate
3 years agobluesky2022
3 years, 1 month agolupindepin
3 years, 1 month ago