Skip to main content

This python library generates quotes

Project description

QUOTES LIBRARY

Overview

This Python library is designed to provide an easy and efficient quotes retrieval. It supports various query options, including filtering by category, author, selecting a random quote, or specifying the number of quotes to retrieve. This library is perfect for applications that need to display inspirational, humorous, thematic and other quotes to users. It comprise 500k quotes and 100+ categories.

Features

  • Retrieve Quotes by Category: Users can specify a category to filter the quotes. This is useful for applications that need to display quotes relevant to specific themes or subjects.
  • Find Quotes by Author: This feature allows users to retrieve quotes from their favorite authors, making it easy to find wisdom from specific thinkers or writers.
  • Random Quote Selection: For a more spontaneous experience, users can retrieve a random quote. This feature is ideal for daily quote applications or when you want to offer users a surprise inspiration.
  • Limit the Number of Quotes: Users can specify how many quotes they want to retrieve, offering flexibility for different use cases, whether it's displaying a single quote of the day or a list of quotes on a particular topic.
  • Categories: Love, Life, Friend, Leadership, Inspiration, Emotion, Humor, Marriage, Poetry, Romance, Classis, Health, and many more.

Installation

pip install quotes-library

or

pip install -e git+https://github.com/mymi14s/quotes_library#egg=quotes_library

To use this library, you must have Python installed on your system

Usage

To use this library, you need to import the get_quotes function from the module. Here's a basic example of how to retrieve and print a random quote:

from quotes_library import get_quotes, get_authors, get_categories

Retrieve a single random quote

random_quote = get_quotes(random=True)
print(random_quote)
{'data': [{'author': 'Gayle Forman, Where She Went', 'category': 'love, romance', 'quote': "I force my eyes upward and look at Mia for the first time. She's still beautiful. Not in an obvious Vanessa LeGrande or Bryn Shraeder kind of way. In a quiet way that's always been devastating to me. Her hair, long and dark, is down now, swimming damply against her bare shoulders, which are still milky white and covered with the constellation of freckles that I used to kiss. The scar on her left shoulder, the one that used to be an angry red weld is silvery pink now. Almost like the latest rage in tattoo accessories. Almost pretty."}], 'status_code': 200, 'status_text': 'success'}

Advanced Usage

Here are more advanced ways to use the library: Retrieve Quotes by Category:

quotes = get_quotes(category='inspirational', count=5)
quotes = get_quotes(category='inspirational', count=5, random=True) # random quotes

Find Quotes by a Specific Author:

quotes = get_quotes(author='Mark Twain', count=3)

Get Multiple Random Quotes:

quotes = get_quotes(random=True, count=3)

Get Authors: authors = get_authors(count=5) authors = get_authors(count=5, random=True) # True|1 to randomize result # if no count supplied all authors will be retrieved.

Get Categories: categories = get_categories(count=5) categories = get_categories(count=5, random=True) # True|1 to randomize result # if no count supplied, all categories will be retrieved.

Error Handling

The library is designed to be resilient and provide useful feedback. In case of a database connection error or query failure, it returns a structured response indicating the status code and error message.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Github Quotes Library

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quotes_library-0.4.tar.gz (45.1 MB view details)

Uploaded Source

Built Distribution

quotes_library-0.4-py3-none-any.whl (45.2 MB view details)

Uploaded Python 3

File details

Details for the file quotes_library-0.4.tar.gz.

File metadata

  • Download URL: quotes_library-0.4.tar.gz
  • Upload date:
  • Size: 45.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for quotes_library-0.4.tar.gz
Algorithm Hash digest
SHA256 533c30451a4d345a87f749766f97fd9173e451a6e4f97810b4e65b73ef9a80b0
MD5 018a13d9b52ac8d258bc698676f41be4
BLAKE2b-256 584be8170b436d1f8722dc2b97290c2001dab58fa92ad7991a711c8ff17fda9b

See more details on using hashes here.

File details

Details for the file quotes_library-0.4-py3-none-any.whl.

File metadata

  • Download URL: quotes_library-0.4-py3-none-any.whl
  • Upload date:
  • Size: 45.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for quotes_library-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8ba1e601a87f97f67871d550c8a658fcd2e1667513cac1fd50eed099803f15fc
MD5 3eff8a5fee02eeadaf1f224f0492477a
BLAKE2b-256 21ca7ebbc3c73ca75cec6ddd498e3d930280b67e2f715ed7bcc2e6aad181cec7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page