示例#1
0
def insert():
    author = request.form.get('author')
    affiliation = request.form.get('aff')
    citedby = request.form.get('num_citations')
    title = request.form.get('name')
    year = request.form.get('pub_year')
    journal = request.form.get('j_name')
    pub_url = request.form.get('pub_url')
    db = DB()
    result = db.insert_article(author, affiliation, citedby, title, year,
                               pub_url, journal)
    if result == False:
        return jsonify({"status": "fail"})
    else:
        return jsonify({"status": "success"})
示例#2
0
def insert():
    db = DB()
    insert_data = json.loads(request.form.get('data'))
    status = db.insert_article(insert_data)
    db.close()
    return jsonify({"code": status})