예제 #1
0
def bulk_create_content(user, org):
    """
    bulk create content items.
    """
    req_data = request_data()
    extract = arg_bool('extract', default=True)
    recipe_id = arg_str('recipe_id', default=None)

    job_id = load_data.content(
        req_data,
        org_id=org.id,
        recipe_id=recipe_id,
        extract=extract,
        queued=True)
    ret = url_for_job_status(apikey=user.apikey, job_id=job_id, queue='bulk')
    return jsonify(ret)
예제 #2
0
def create_content(user, org):
    """
    Create a content item
    """
    req_data = request_data()
    extract = arg_bool('extract', default=True)
    recipe_id = arg_str('recipe_id', default=None)

    content = load_data.content(
        req_data,
        org_id=org.id,
        recipe_id=recipe_id,
        extract=extract,
        queued=False)
    if len(content) == 1:
        content = content[0]
    return jsonify(content)