def api_request_basic():
"""Establishes the endpoint that is used for the basic 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, "basic")
return send_file(file_path)
except BadRequest as e:
return prepare_400("api_request_basic", str(e))
except ValueError as e:
return prepare_400("api_request_basic", str(e))
except Exception as e:
print type(e)
return prepare_500("api_request_basic", str(e))
评论列表
文章目录