utils.py 文件源码

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

项目:grest 作者: mostafa 项目源码 文件源码
def make_request(url, json_data=None, method="post", headers=None):
    if (headers is None):
        headers = {
            "Content-Type": "application/json",
            "Accept": "application/json"
        }

    try:
        func = getattr(requests, method)
        if (json_data):
            response = func(url, json=json_data, headers=headers)
        else:
            response = func(url, headers=headers)

        if (response.content):
            return json.loads(response.content)
    except Exception as e:
        app.ext_logger.exception(e)
        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号