devtools_parser.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:devtools-parser 作者: WPO-Foundation 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号