MCPcopy Create free account
hub / github.com/internetarchive/openlibrary / price_api

Function price_api

openlibrary/fastapi/internal/api.py:358–372  ·  view source on GitHub ↗

Returns pricing metadata from Amazon and BetterWorldBooks for a given book. Requires either an `isbn` or `asin` query parameter.

(
    isbn: Annotated[str | None, Query(description="ISBN-10 or ISBN-13", min_length=10, max_length=13)] = None,
    asin: Annotated[str | None, Query(description="Amazon ASIN", min_length=10, max_length=10)] = None,
)

Source from the content-addressed store, hash-verified

356 description="Returns pricing data for a book from Amazon and BetterWorldBooks.",
357)
358async def price_api(
359 isbn: Annotated[str | None, Query(description="ISBN-10 or ISBN-13", min_length=10, max_length=13)] = None,
360 asin: Annotated[str | None, Query(description="Amazon ASIN", min_length=10, max_length=10)] = None,
361) -> dict:
362 """
363 Returns pricing metadata from Amazon and BetterWorldBooks for a given book.
364 Requires either an `isbn` or `asin` query parameter.
365 """
366 if not (isbn or asin):
367 raise HTTPException(
368 status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
369 detail="isbn or asin required",
370 )
371
372 return await get_price_data_async(isbn or "", asin or "")
373
374
375class FollowEntry(BaseModel):

Callers

nothing calls this directly

Calls 1

get_price_data_asyncFunction · 0.90

Tested by

no test coverage detected