def upload_policy(self, policy_file_path):
try:
data = {"policy": ""}
files = {'file': (ntpath.basename(policy_file_path), open(policy_file_path, 'rb'),)}
except IOError as e:
return WebInspectResponse(success=False,
message="There was an error while handling the request{}.".format(e))
# hack. doing this avoids us later specifying a content-type of application/json. needs a refactor
headers = {
'Accept': 'application/json'
}
return self._request('POST', '/webinspect/securebase/policy', data=data, files=files, headers=headers)
评论列表
文章目录