另外由于请求的结果一般是一个很长的 json 数据,我的做法是第一次请求,可以吧结果保存成 JSON 文件,第二次请求的时候首先检查这个 JSON 文件的最近修改时间,如果最近修改时间小于指定的天数,比如...3 天,如果 3 天内修改过的话,直接从 JSON 文件加载数据,否则重新发送请求,加载数据。...write_json(filename, result): with open(filename, 'w') as f: dump(result, f, indent=2)
def write_csv...try: if isfile(filename) and check_file_modified(filename, 3): with open(filename, 'r'...": write_csv("result.csv", cve_result, ["id", "last-modified", "cvss", "summary"])