Started on framework for library api. Can now look up book title by isbn. Also added test.py to experiment with the isbn lookup stuff.
This commit is contained in:
14
main.py
14
main.py
@@ -1,4 +1,5 @@
|
|||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
|
from isbnlib import meta
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
@@ -6,3 +7,16 @@ app = FastAPI()
|
|||||||
@app.get('/')
|
@app.get('/')
|
||||||
async def root():
|
async def root():
|
||||||
return {"message": "Hello World"}
|
return {"message": "Hello World"}
|
||||||
|
|
||||||
|
@app.post('/checkin/{isbn}')
|
||||||
|
async def checkin(isbn):
|
||||||
|
return{"Checked in": isbn}
|
||||||
|
|
||||||
|
@app.get('/checkout/{isbn}')
|
||||||
|
async def checkout(isbn):
|
||||||
|
return{"Checked Out": isbn}
|
||||||
|
|
||||||
|
@app.put('/lookup/{isbn}')
|
||||||
|
async def lookup(isbn):
|
||||||
|
info = meta(isbn, service='Default')
|
||||||
|
return{"Title": info['Title']}
|
||||||
|
|||||||
Reference in New Issue
Block a user