【发布时间】:2018-12-11 11:22:33
【问题描述】:
我正在尝试使用 python 和 Nessus REST API (func POST /file/upload) 将导出的扫描 (.nessus) 文件上传到 Nessus 社区版服务器,但是我不断收到null 这样的响应@ 987654322@ 在回复中。
我似乎无法在 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 是我用来查询所有其他信息的标头值的字典。
任何帮助将不胜感激。
【问题讨论】:
标签: python rest python-requests nessus