def is_operation_supported(self, operation=None, headers={}):
url = self._host + '/graph/operations/' + operation.get_operation()
headers['Content-Type'] = 'application/json;charset=utf-8'
request = urllib.request.Request(url, headers=headers)
try:
response = self._opener.open(request)
except urllib.error.HTTPError as error:
error_body = error.read().decode('utf-8')
new_error_string = ('HTTP error ' +
str(error.code) + ' ' +
error.reason + ': ' +
error_body)
raise ConnectionError(new_error_string)
response_text = response.read().decode('utf-8')
return response_text
评论列表
文章目录