def write(self):
"""Write out the resulting json data"""
if self.out_file is not None and len(self.result['pageData']) and \
len(self.result['requests']):
try:
_, ext = os.path.splitext(self.out_file)
if ext.lower() == '.gz':
with gzip.open(self.out_file, 'wb') as f_out:
json.dump(self.result, f_out)
else:
with open(self.out_file, 'w') as f_out:
json.dump(self.result, f_out)
except Exception:
logging.critical("Error writing to " + self.out_file)
评论列表
文章目录