Skip to main content

Bookshare API Wrapper

Tests Python 3.8+

Python wrapper for Bookshare API v1. Note: API v1 is officially sunset but still functional.

Installation

uv add bookshare

Authentication

All three required: API key, Bookshare username, and Bookshare password.

from bookshare import BookshareAPI

# Pass all credentials at initialization
api = BookshareAPI(
    API_key="bookshare_api_key",
    username="bookshare_username",
    password="bookshare_password"
)

# Or set username/password separately
api = BookshareAPI(API_key="bookshare_api_key")
api.set_credentials("bookshare_username", "bookshare_password")  # Required before use

Usage

# Search
results = api.title_search("python programming", page=1)
results = api.author_search("asimov", page=1)
results = api.full_text_search("robotics", page=1)

# Lookup
book = api.isbn_lookup("9780134685991")
book = api.book_lookup("12345")

# Browse
latest = api.latest(page=1)
popular = api.popular(page=1)

# Download
content = api.download(id="12345", version=1, chunk_size=8192)
for chunk in content:
    # Process chunk
    pass

Command-Line Interface

Installing the package also provides a bookshare command. Credentials come from --api-key / --username / --password flags, or the BOOKSHARE_API_KEY, BOOKSHARE_USERNAME, and BOOKSHARE_PASSWORD environment variables.

# Search the catalog (default --by title; also author, fts, all, isbn)
bookshare search "python programming"
bookshare search "asimov" --by author
bookshare search "9780134685991" --by isbn

# Machine-readable output (raw book records)
bookshare search "robotics" --by fts --json

# Download a book by its numeric id (from search results)
bookshare download 12345 -o book.epub          # write to a file
bookshare download 12345 > book.epub           # or stream to stdout

Run it without installing via uvx:

BOOKSHARE_API_KEY=... uvx bookshare search "asimov" --by author --json

API Methods

Search:

  • title_search(title, page=1)
  • author_search(author, page=1)
  • author_and_title_search(text, page=1)
  • full_text_search(text, page=1)
  • category_search(category, page=1)
  • grade_search(grade, page=1)

Lookup:

  • isbn_lookup(isbn)
  • book_lookup(id)
  • periodical_lookup(id)
  • periodical_edition_lookup(id, edition)

Browse:

  • latest(page=1)
  • popular(page=1)
  • periodical_list(page=1, limit=100)

Reference:

  • category_list()
  • grade_list()

Content:

  • download(id, version=1, chunk_size=8192) - Returns iterator

User:

  • user_info()

Development

# Setup
git clone https://github.com/accessibleapps/bookshare.git
cd bookshare
uv sync --extra dev

# Test
uv run pytest
uv run pytest --cov=bookshare

# Lint
uv run ruff check .
uv run ruff format .

Metadata

Release files for bookshare 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bookshare 0.13.0
File Size Uploaded
bookshare-0.13.0.tar.gz 552.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bookshare 0.13.0
File Interpreter ABI Platform
bookshare-0.13.0-py3-none-any.whl Python 3 none any Details

Total release size: 559.3 kB

Release files / bookshare-0.13.0.tar.gz

Download URL bookshare-0.13.0.tar.gz
Size 552.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d611c241d6bed67e738f9ba23b484131dc85f7155f8edc315cfe2f3fc7ddf73c
BLAKE2b-256 checksum
How to use checksums
01099e3bb020546a99cfdf74dc8aa23c4f81f9c89a3bdc44cafa095dedc9dd37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.8

Release files / bookshare-0.13.0-py3-none-any.whl

Download URL bookshare-0.13.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce27de42a88dbfc405f8854b626e2281e9d5a25b4d1e0955aa681a88fd6e7d70
BLAKE2b-256 checksum
How to use checksums
2f578dcaea225d0a3d7cca0d686de13171e7f592a2b4332c5c6aab7fcc7b174f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.8

Release history Release notifications | RSS feed

This release

0.13.0 This release

2 release files

0.11.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page