Skip to content

API reference

Get more out of ZenquotesPy. This page provides an overview of all functions available in the zenquotespy package.

zenquotespy.random()

random()

Get a random quote on each request.

Returns:

  • str: A string of the random quote.

Example:

import zenquotespy

quote = zenquotespy.random()

print(quote)

zenquotespy.today()

today()

Get the quote of the day on each request.

Returns:

  • str: A string of today's quote.

Example:

import zenquotespy

quote = zenquotespy.today()

print(quote)

zenquotespy.get_bulk_quotes()

get_bulk_quotes()

Get 50 random quotes on each request.

Returns:

  • list[str]: A list where each element is a formatted string containing a quote and its author.

Example:

import zenquotespy

quotes = zenquotespy.get_bulk_quotes()

for quote in quotes:
    print(quote)

zenquotespy.image()

image()

Get a random inspirational image on each request.

Args:

  • save_path (str) (optional): The file path where the image will be saved. Defaults to 'quote_image.jpg' in the current working directory.

Returns:

  • str: The file path where the image has been saved.

Example:

import zenquotespy

img = zenquotespy.image()

print(f"Quote image successfully saved to {img}")

Example with custom path:

import zenquotespy

img = zenquotespy.image("images/quote.jpg")

print(f"Quote image successfully saved to {img}")

zenquotespy.attribution()

attribution()

Attribution for inspirational quotes provided by ZenQuotes API

Returns:

Example:

import zenquotespy

attrib = zenquotespy.attribution()

print(attrib)