serverleak.py 文件源码

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

项目:PrivacyScore 作者: PrivacyScore 项目源码 文件源码
def _response_to_json(resp: Response) -> bytes:
    """Generate a json byte string from a response received through requests."""
    # we store only the top of the file because core dumps can become very large
    # also: we do not want to store more potentially sensitive data than necessary
    # to determine whether there is a leak or not

    return json.dumps({
        'text': resp.content[0:50*1024].decode(errors='replace'),
        'status_code': resp.status_code,
        'headers': dict(resp.headers),
        'url': resp.url,
    }).encode()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号