Skip to content
Rahul Kumaresan edited this page Mar 18, 2019 · 2 revisions

Author

1. Searching OpenLibrary with similar names using the Open Library auto-complete API

Returns a list of matching authors from the OpenLibrary authors' autocomplete API.

Usage:

>>> from olclient.openlibrary import OpenLibrary
>>> ol = OpenLibrary()
>>> ol.Author.search('Dan Brown')

or

>>> from olclient.openlibrary import OpenLibrary
>>> ol = OpenLibrary()
>>> ol.Author.search('Dan Brown', 5)

2. Searching Open Library to get OLID after searching by name

Uses the Authors auto-complete API to find OpenLibrary Authors with similar names. If any name is an exact match then return the matching author's 'key' (i.e. olid). Otherwise, return None.

>>> from olclient.openlibrary import OpenLibrary
>>> ol = OpenLibrary
>>> author_olid = ol.Book.get_olid_by_name('Dan Brown')

3. Retrieving Open Library Author by OLID

Retrieves an OpenLibrary Author Object by Author OLID.

>>> from olclient.openlibrary import OpenLibrary
>>> ol = OpenLibrary()
>>> ol.Author.get('OL39307A')

4. Retrieving Works by an Open Library Author

Retrieve works by an Author through OLID in JSON format.

>>> from olclient.openlibrary import OpenLibrary
>>> ol = OpenLibrary()
>>> author = ol.Author.get('OL39307A')
>>> works_list = author.works()

to obtain paginated response, use the following parameters:

limit - To set the number of works to return.

offset - To specify the index of the first work to be returned.

>>> from olclient.openlibrary import OpenLibrary
>>> ol = OpenLibrary()
>>> author = ol.Author.get('OL39307A')
# list 20 works at a time
>>> works_list = author.works(limit=20)
# list the 2nd set of 20 works
>>> works_list = author.works(limit=20, offset=20)

Clone this wiki locally