def post(self, url, json=None, data=None, **kwargs):
"""Sends a POST request.
Args:
url(basestring): The URL of the API endpoint.
json: Data to be sent in JSON format in tbe body of the request.
data: Data to be sent in the body of the request.
**kwargs:
erc(int): The expected (success) response code for the request.
others: Passed on to the requests package.
Raises:
SparkApiError: If anything other than the expected response code is
returned by the Cisco Spark API endpoint.
"""
assert isinstance(url, basestring)
# Expected response code
erc = kwargs.pop('erc', EXPECTED_RESPONSE_CODE['POST'])
response = self.request('POST', url, erc, json=json, data=data,
**kwargs)
return extract_and_parse_json(response)
评论列表
文章目录