错误:无法连接'str'和'int'对象
尝试从我们的qualys漏洞扫描程序自动下载报告,但由于变量是整数而不是字符串,我收到错误,我知道我需要做str(变量)名称,但它没有'工作
newreportID在第8行抛出错误,错误高于
def downloadReport(s, newreportID):
# ---Download reports---
payload = {
'action':'fetch',
'id': newreportID,
}
r = s.post('https://qualysapi.qg2.apps.qualys.com:443/api/2.0/fo/report/', data=payload)
with open("Z:/Shared/Scan_Report_"+ newreportID +".csv", "wb") as report:
report.write(r.content)
def main(newreportID):
s = requests.Session()
s.headers.update({'X-Requested-With':'Facklers PyQual python primer'})
login(s)
listReports(s, newreportID)
downloadReport(s, newreportID)
logout(s)
s.close()
if __name__ == "__main__": main(newreportID)