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:
dan
2021-06-07 02:31:54 -04:00
parent b2788ec472
commit 5a2f4da937
2 changed files with 25 additions and 1 deletions

16
main.py
View File

@@ -1,8 +1,22 @@
from fastapi import FastAPI
from isbnlib import meta
app = FastAPI()
@app.get('/')
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']}