can read from html forms now. Added simple html page to submit isbn to lookup.
This commit is contained in:
8
main.py
8
main.py
@@ -1,4 +1,4 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi import FastAPI, Form
|
||||
from isbnlib import meta
|
||||
|
||||
app = FastAPI()
|
||||
@@ -19,7 +19,7 @@ async def checkout(isbn):
|
||||
return{"Checked Out": isbn}
|
||||
|
||||
|
||||
@app.put('/lookup/{isbn}')
|
||||
async def lookup(isbn):
|
||||
info = meta(str(isbn), service='wiki')
|
||||
@app.post('/lookup')
|
||||
async def lookup(isbn: str = Form(...)):
|
||||
info = meta(isbn, service='wiki')
|
||||
return{"Title": info['Title']}
|
||||
|
||||
Reference in New Issue
Block a user