@app.route('/api/<int:q_isbn>')
def isbn(q_isbn):
res = db.execute("SELECT * FROM books WHERE isbn LIKE :isbn LIMIT 1", {"isbn": q_isbn}).fetchone()
if res is None:
return jsonify(
{
"error_code": 404,
"error_message": "Not Found"
}
)
result = {
"title": res.title,
"author": res.authors,
"year": res.year,
"isbn": res.isbn,
}
return jsonify(result)