Drag and drop the code from the bottom onto the box where the code is missing to retrieve the RESTCONF running configuration for an interface named TwentyFiveGigabitEthernet 1/1/2. Not all options are used.
4 should be response.text
If use json, it should have () after json like response.json()
https://www.geeksforgeeks.org/response-text-python-requests/
https://www.geeksforgeeks.org/response-json-python-requests/
import requests, getpass # This fills the first blank with 'import'
url = 'https://<ipaddress>/restconf/data/Cisco-IOS-XE-native:native/interface/TwentyFiveGigE=1%2F1%2F2'
def askCredentials():
user = input('Username: ')
password = getpass.getpass('Password: ')
return (user, password) # 'return' is already correctly placed in the function
def getRequest(url, credentials):
headers = dict() # This fills in with 'dict()' to initialize the headers dictionary
headers['Accept'] = 'application/yang-data+json'
return requests.get(url, headers=headers, auth=credentials, verify=False) # This fills in with 'return'
creds = askCredentials()
response = getRequest(url, creds)
if response.status_code == 200:
print(response.text) # This fills in with 'text' to print the response body
upvoted 1 times
...
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.
tonko
Highly Voted 1 year, 8 months agonicovl
1 year, 8 months agolmqnam
1 year agoMuste
10 months agojbmac
Most Recent 8 months, 4 weeks ago