exam questions

Exam 200-901 All Questions

View all questions & answers for the 200-901 exam

Exam 200-901 topic 1 question 113 discussion

Actual exam question from Cisco's 200-901
Question #: 113
Topic #: 1
[All 200-901 Questions]

FILL BLANK -
Fill in the blanks to complete the Python script to update the Webex Teams membership of a room using the Python requests library. import requests url = `https://api.ciscospark.com/v1/memberships/
Y2lzY29zcGFyazov379971079INISVAvOTJiM2RkOWEtNjc1ZC00YTQxLThjNDEtMmFiZGY4OWY0NGY0OjExNzJkNmYwLTJIYzMtMTFIOS1iOWI3LWNmMjg3M
TJhYTkzNw`
my_token = `AbCdEf123456`
payload = `{\n \`isModerator\`: true\n}`
headers = {
'Authorization': 'Bearer' + my_token,
'Content-Type': 'application/json'
}
response = requests. ___________ (`PATCH`, url, headers= ___________, data = ____________ ) print(response.text.encode('utf8'))

Show Suggested Answer Hide Answer
Suggested Answer: See explanation below.
response = requests.request(ג€PATCHג€, url, headers= headers, data = payload ) print(response.text.encode('utf8'))

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ThePokemonNuzlockingMaster
Highly Voted 11 months, 4 weeks ago
The answer they give is correct. You can specify "requests.request()" with the HTTP Method inside (as they've done in this question with "PATCH"), or you can specify the HTTP method as the python attribute, e.g. requests.patch So in this example, they have given the correct answer, however both of the below are completely valid: response = requests.request("PATCH", url, headers= headers, data = payload ) print(response.text.encode('utf8')) response = requests.patch(url, headers= headers, data = payload ) print(response.text.encode('utf8'))
upvoted 5 times
...
macxsz
Most Recent 10 months, 4 weeks ago
request header payload
upvoted 4 times
...
designated
1 year, 2 months ago
Buuut we can construct it using request when the method is inside of the response requests.request(method, url, **kwargs) https://2.python-requests.org/en/master/api/#requests.request
upvoted 1 times
...
designated
1 year, 2 months ago
I think it should be: response = requests.patch(url, headers=headers, data =payload)
upvoted 3 times
...
Rosenkranz
1 year, 3 months ago
I'd think the first blank is "post", not "request".
upvoted 2 times
NetMex
10 months ago
No, because you want to update the membership of a user, PATCH=Create
upvoted 1 times
NetMex
10 months ago
My bad PATCH=Update
upvoted 1 times
...
...
...
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.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago