26 lines
451 B
Python
26 lines
451 B
Python
from fastapi import FastAPI
|
|
from isbnlib import meta
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get('/')
|
|
async def root():
|
|
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(str(isbn), service='wiki')
|
|
return{"Title": info['Title']}
|