nerdexam
Cisco

200-901 · Question #120

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 =…

The correct answer is A. request. The Python requests library exposes a generic requests.request() method that accepts an HTTP verb string along with the URL, headers, and data parameters needed to execute any API call.

Understanding and Using APIs

Question

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.ciscopark.com/v1/memberships/Y2lzY29zcGFyazov371558228INIS VAvOTJiM2RkOWEtNjc1ZC00YTQxLThjNDEtMmFiZGY4OWY0NGY0OjExNzJkNmYwLTJIYzMT FIOS1Iowi3lwnMmJG3mtjhYTkzNw" payload = "{\n "isModerator": true\n}" headers = { 'Authorization': 'Bearer', 'Content-Type': 'application/json' } response = requests. ___________ ("PATCH", url, headers= ___________, data = ____________ ) print(response.text.encode('utf8')) Answer: See explanation below.

Options

  • Arequest

How the community answered

(43 responses)
  • A
    100% (43)

Why each option

The Python requests library exposes a generic requests.request() method that accepts an HTTP verb string along with the URL, headers, and data parameters needed to execute any API call.

ArequestCorrect

requests.request('PATCH', url, headers=headers, data=payload) is the generic call signature of the Python requests library, where the first argument is the HTTP method string - here 'PATCH' to partially update an existing Webex Teams membership - followed by the target URL, the headers dictionary containing the Bearer token and Content-Type, and the JSON payload.

Concept tested: Python requests library generic request method for REST API calls

Source: https://requests.readthedocs.io/en/latest/api/#requests.request

Topics

#Python requests library#REST API#HTTP PATCH method#Webex API

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice