Find me something to read!
I wrote this utility to extract the most value from two services I love dearly:
- My local public library
How I use it
Whenever I come across a title I'd like to read some day, I store it on my Goodreads shelf. When I'd like to visit my local library branch, I visit biblio.dcain.me to see which titles are available to be checked out.
My local library branch does not have the most extensive collection. Instead of meandering the stacks until I find a book I like, or fruitlessly querying the catalog to see if that interesting new book is on the shelf, I'd much rather have a script do the hard work for me.
Can I use this?
The web interface currently supports San Francisco & Seattle, but if you live near one of the ~190 public libraries using the BiblioCommons system, then running this software locally should work for you. It relies on undocumented APIs, so your mileage may vary.
Apply for a Goodreads Developer Key.
Obtain your Goodreads user id
[Optional] Set both these values in your
export GOODREADS_USER_ID=123456789 export GOODREADS_DEV_KEY=whatever-your-actual-key-is
Run the script!
./lookup.py --biblio seattle # Set to your own city!
Make sure you adhere to the terms of Goodreads' API, and have fun.
You can choose to show only titles available at your local branch, select titles
from another Goodreads shelf, etc. Pass
--help to see all options:
usage: lookup.py [-h] [--branch BRANCH] [--shelf SHELF] [--biblio BIBLIO] [--csv CSV] [user_id] [dev_key] See which books you want to read are available at your local library. positional arguments: user_id User's ID on Goodreads dev_key Goodreads developer key. See https://www.goodreads.com/api optional arguments: -h, --help show this help message and exit --branch BRANCH Only show titles available at this branch. e.g. 'Fremont Branch' --shelf SHELF Name of the shelf containing desired books --biblio BIBLIO subdomain of bibliocommons.com (seattle, vpl, etc.) --csv CSV Output results to a CSV of this name.
How does this work?
bibliophilePython module does the legwork of querying Goodreads & BiblioCommons (respectively, these are the services needed to find which books I'm interested in, and which books are available at the library).
- The Python module is deployed as a serverless function on AWS Lambda.
- The function is configured with an API Gateway to enable a REST API.
serverlessprovides automated deployment & configuration on AWS.
- A React application provides the user interface on biblio.dcain.me.
- The React application is hosted as a static site on S3.
- The static site is deployed behind CloudFront (for speed & HTTPS).
This repository contains two projects, which may be deployed separately (or together)
Python backend (Lambda function)
- Create an IAM user for
serverlesswith permissions to create CloudFormation stacks, S3 buckets, Lambda functions, and more. Standard practice with
serverlessis to just grant the user an administrator policy, though this is not ideal security.
- Create access keys for this user, then run:
SLS_DEBUG=* ./node_modules/serverless/bin/serverless deploy
serverless deploy is contained in
If you want to deploy this service to your own domain, you'll need to
tweak settings in there (namely, changing domain names).
React frontend (user interface at biblio.dcain.me)
See README.md for more information.