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.
Note: This library uses Git LFS to manage its database file (approx 114MB). Before cloning or pulling updates, please ensure you have Git LFS installed:
# Install Git LFS
git lfs install
# Pull the database file
git lfs pull
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.
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 Quotes API Docker Quotes API
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quotes_library-1.0.1.tar.gz.
File metadata
- Download URL: quotes_library-1.0.1.tar.gz
- Upload date:
- Size: 40.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1d19636e1ff3b366862275511d4460edc71e70e9ec8453585b36b8c40c6a5af
|
|
| MD5 |
ba18cdb2e1336ccb9e060bf936204e17
|
|
| BLAKE2b-256 |
f3c45fc9f37d1acf1bb33687e0eccfe2c9277b9e7ff9d928ffe09dbb74604855
|
Provenance
The following attestation bundles were made for quotes_library-1.0.1.tar.gz:
Publisher:
pypi.yaml on mymi14s/quotes_library
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quotes_library-1.0.1.tar.gz -
Subject digest:
a1d19636e1ff3b366862275511d4460edc71e70e9ec8453585b36b8c40c6a5af - Sigstore transparency entry: 885417501
- Sigstore integration time:
-
Permalink:
mymi14s/quotes_library@0c4c8f4dd34be6aad4ece8b8116044829900f7f9 -
Branch / Tag:
refs/heads/production - Owner: https://github.com/mymi14s
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@0c4c8f4dd34be6aad4ece8b8116044829900f7f9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file quotes_library-1.0.1-py3-none-any.whl.
File metadata
- Download URL: quotes_library-1.0.1-py3-none-any.whl
- Upload date:
- Size: 40.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3aa6c038e811b314020e8a39538c18f5bd20ee9f97c7b9b69a1065a3cd2e6b1c
|
|
| MD5 |
055e8aac64f021f7ff77b1aed317219a
|
|
| BLAKE2b-256 |
4b1c9d00c9759a39f4293d8e316c2956de4c9be8033bf345eddcec1568ce51b2
|
Provenance
The following attestation bundles were made for quotes_library-1.0.1-py3-none-any.whl:
Publisher:
pypi.yaml on mymi14s/quotes_library
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
quotes_library-1.0.1-py3-none-any.whl -
Subject digest:
3aa6c038e811b314020e8a39538c18f5bd20ee9f97c7b9b69a1065a3cd2e6b1c - Sigstore transparency entry: 885417547
- Sigstore integration time:
-
Permalink:
mymi14s/quotes_library@0c4c8f4dd34be6aad4ece8b8116044829900f7f9 -
Branch / Tag:
refs/heads/production - Owner: https://github.com/mymi14s
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@0c4c8f4dd34be6aad4ece8b8116044829900f7f9 -
Trigger Event:
push
-
Statement type: