我正在尝试使用 python 和 Nessus REST API (func POST /file/upload) 将导出的扫描 (.nessus) 文件上传到 Nessus 社区版服务器,但是我在响应中不断收到null
这样{"fileuploaded":null}
的响应。
我似乎无法在 API 文档中看到还需要什么。
def upload_scan_file(_path):
_url = url+"/file/upload"
_head['Content-type'] = ''
_files = {"file": open(_path, 'rb'), "no_enc" : "0"}
r = requests.post(_url, headers=_head, verify=False, files=_files)
return r.text
我在标题字典中取消设置键的原因Content-type
是我得到了一个{'error': Content-type: application/json not supported'}
_path
包含文件路径。
_head
是我用来查询所有其他信息的标题值的字典。
任何帮助,将不胜感激。