handler.py 文件源码

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

项目:mWorkerService 作者: smices 项目源码 文件源码
def parse_json(http_response, response):
    """If the body is not empty, convert it to a python object and set as the value of
    response.body. http_response is always closed if no error occurs.

    :param http_response: the http_response object returned by HTTPConnection.getresponse()
    :type http_response: httplib.HTTPResponse

    :param response: general response object which will be returned to the caller
    :type response: baidubce.BceResponse

    :return: always true
    :rtype bool
    """
    body = http_response.read()
    if body:
        response.__dict__.update(json.loads(body, object_hook=utils.dict_to_python_object).__dict__)
    http_response.close()
    return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号