Git Product home page Git Product logo

py-gutenberg's Introduction

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 the public instance of the Gutendex API, https://gutendex.com. 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-two.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 over at gutendex.com. I have no reason to believe the hosting they've setup is meant to sustain more than a few concurrent users, so please be kind a limit your requests where possible. Additionally, if you intend to use this in a production environment, it is highly encouraged that you self-host.

py-gutenberg's People

Contributors

peterrauscher avatar

py-gutenberg's Issues

add tests

high priority

  • test init
  • test __get_books
  • test___get_book
  • test_get_book
  • test_get_book_metadata
  • test_get_book_text

other tests

  • test get_all_books
  • test get_public_domain_books
  • test get_copyrighted_books
  • test get_books_by_language
  • test get_books_by_ids
  • test get_books_by_search

dockerize app

  • add dockerfile and docker compose
  • write a powershell script to boot up and backfill app with data for self-hosting purposes.
  • consider if we should limit size on local
  • consider cheap webserver to host.
  • consider if turning into a fastapi app would be ideal?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.