An open API service indexing awesome lists of open source software.

https://github.com/fl1yd/quotes

✨ Service for generating quote images using Jinja2 templates
https://github.com/fl1yd/quotes

fastapi imgkit jinja2 poetry python quotes telegram template

Last synced: 2 months ago
JSON representation

✨ Service for generating quote images using Jinja2 templates

Awesome Lists containing this project

README

        





Quotes API: Quote Image Generator

What is this?

Quotes API is a FastAPI-based service that allows users to generate visually appealing quote images resembling Telegram messages

Installing

> Before installing Quotes API, ensure you have Poetry installed. You can install Poetry by following the [Poetry installation guide](https://python-poetry.org/docs/#installation)

Once Poetry is installed, clone the repository and install dependencies:


git clone https://github.com/Fl1yd/Quotes
cd Quotes
poetry install

Additionally, ensure wkhtmltopdf version 0.12.5 is installed on your system:

Download the appropriate package for your distribution from the wkhtmltopdf releases page

Install it using your package manager. For example, on Ubuntu:


sudo apt-get install -y wkhtmltopdf=0.12.5

> Note: If the specific version is not available in your package manager, you may need to download the binary directly and follow the installation instructions provided in the release notes

Usage

To use Quotes API, start the FastAPI application:


poetry run python3 -m app

The application will start on the port specified in the config.toml file (default is 1337). You can then access the API documentation at `http://localhost:1337/docs`

API Endpoints

Quotes API provides the following endpoint for generating quote images:

- **Generate quote image:**
Use the POST /generate endpoint to generate a quote image. You need to provide a `Messages` object with the required data


{
"messages": [
{
"text": "This is a quote",
"author": {
"id": 1,
"name": "Author Name"
}
}
],
"quote_color": "#000000",
"text_color": "white"
}

Configuration

Customize your application settings by updating the config.toml file:


[settings]
[settings.quote]
quality = 85
text_color = "white"
background_color = "#162330"

[settings.logging]
level = "INFO"

[settings.server]
port = 1337

License


Quotes API is licensed under the MIT License