def put(self, location, params=None):
"""Dispatch a PUT request to a SeaMicro chassis.
The seamicro box has order-dependent HTTP parameters, so we build
our own get URL, and use a list vs. a dict for data, as the order is
implicit.
"""
opener = urllib.request.build_opener(urllib.request.HTTPHandler)
url = self.build_url(location, params)
request = urllib.request.Request(url)
request.get_method = lambda: 'PUT'
request.add_header('content-type', 'text/json')
response = opener.open(request)
json_data = self.parse_response(url, response)
return json_data['result']
评论列表
文章目录