Skip to main content

py-gutenberg

Install from pip Tests Status Build Status License Latest Release Version Number Supported Python Versions

Overview

The py-gutenberg package is a Python library that provides methods to access the Project Gutenberg library. Users can search for books based on a variety of metadata, get full texts in various formats, and retrieve metadata for books by their ID number.

Installation

⚠️ This package has only been tested on Python 3.7 and above. There are no plans for a Python 2 version.

The package can be installed using the pip package manager:

pip install py-gutenberg

Usage

You should import the module like so:

from gutenberg import GutenbergAPI

The GutenbergAPI constructor defaults to using a public instance of the Gutendex API, hosted by me at https://gutendex.devbranch.co. If you are self-hosting the API, you can specify the IP address or URL of your instance with the instance_url parameter.

# Uses the public instance
gb = GutenbergAPI()
# Uses a self-hosted instance
gb_private = GutenbergAPI(instance_url="https://gutendex.yourdomain.com")

Book Lists and Searching

Here's a simple example to get a list of the most recently uploaded books:

gb.get_all_books()

Or, to get only public domain books:

gb.get_public_domain_books()

Individual Books

To get an individual book's metadata:

gb.get_book_metadata()

Or, to get the full text of a book:

gb.get_book_text()

Full usage information is available in the documentation

Thanks

This module is built on the wonderful but unofficial API built by @garethbjohnson known as Gutendex. By default, this library uses a public instance I'm hosting myself, but does not have the bandwidth to maintain more than a few concurrent users. Please be kind and limit your requests where possible. Additionally, if you intend to use this library in a production environment, I highly encourage you to self-host.

Read about self-hosting the API here!

Metadata

Release files for py-gutenberg 1.0.3

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

Source distribution (sdist)

Source distribution for py-gutenberg 1.0.3
File Size Uploaded
py-gutenberg-1.0.3.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-gutenberg 1.0.3
File Interpreter ABI Platform
py_gutenberg-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / py-gutenberg-1.0.3.tar.gz

Download URL py-gutenberg-1.0.3.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b6a79b194e30672b4fdfa80128c79a0c8285e72ea01ab35e9805618d24fbd94e
BLAKE2b-256 checksum
How to use checksums
9ef00092b62f488dcaf0cd5d333628ddee2c7994a8f0c4a4ebadf2ba27c8ad77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / py_gutenberg-1.0.3-py3-none-any.whl

Download URL py_gutenberg-1.0.3-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ab5b1444a7e32b7eb0e59004416b8ae587d59002f06523a29fc7a862fdeaa82
BLAKE2b-256 checksum
How to use checksums
01eb97868007d7befb1ac624d29ad81007604404164be34192d68efb4c3b462b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.1

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