def put_resource(self, api_path, data, **kwargs):
"""
Helper method for HTTP PUT API requests.
Args:
api_path(str): REST API path
data: JSON data for POST request
Keyword Args:
kwargs: keyword args used for replacing items in the API path
"""
put_headers = {
'Content-Type': 'application/json',
**self.headers
}
url = self.build_api_url(
api_path.format(
tenant=self.tenant,
controllerId=self.controller_id,
**kwargs))
self.logger.debug('PUT {}'.format(url))
self.logger.debug(json.dumps(data))
with aiohttp.Timeout(self.timeout):
async with self.session.put(url, headers=put_headers,
data=json.dumps(data)) as resp:
await self.check_http_status(resp)
评论列表
文章目录