minion.py 文件源码

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

项目:boomerang 作者: EmersonElectricCo 项目源码 文件源码
def api_request_website():
    """Establishes the endpoint that is used for the website fetch mode

    POST body should be json formated.
    Required field(s):
      - url : actual url that is requested to be fetched by the minion

    Optional field(s):
      - user-agent : user agent to be used during the request of the url
                     if this argument is not provided, then the default
                     user agent in the config file will be used.


    """
    try:
        data = request.get_json()
        if data is None:
            raise BadRequest

        file_path = run_job(data, "website")
        return send_file(file_path)

    except BadRequest as e:
        return prepare_400("api_request_website", str(e))
    except ValueError as e:
        return prepare_400("api_request_website", str(e))
    except Exception as e:
        print type(e)
        return prepare_500("api_request_website", str(e))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号