A Python wrapper for the CoolText.com image generation API
Project description
CoolText
A small Python helper for generating images using CoolText's PostChange API. This repository wraps CoolText form options in a simple data model, posts the configuration to CoolText, and returns the rendered image URL.
Example
- Result with logo id -
4618063429:
- Result with logo id -
8:
- Result with logo id -
2975689126:
- Result with logo id -
829964308:
- Result with logo id -
732453157:
- Result with logo id -
1779834160:
...And Many More Are Here...
Features
- Build payloads using a typed
pydanticmodel. - Merge user-provided options with a logo's defaults from
logo-id.json. - Manage HTTP requests and return the final render URL.
Requirements
- Python 3.10+
- See
requirements.txtfor exact package versions.
Installation
Install dependencies with pip:
python -m pip install -r requirements.txt
If you prefer a virtual environment:
python -m venv .venv
.
\venv\Scripts\activate # Windows
python -m pip install -r requirements.txt
Quick Start
- Ensure
logo-id.jsonis present in the repository root. This file mapsLogoIDvalues to their CoolText page links and default form values. The repository includes a generatedlogo-id.json(seelogo-id.pyfor the scraper used to produce it). - Edit
main.pyor create your own script using the library.
Example minimal usage (same logic as in main.py):
from modules import CoolText, PostChangeConfigOptions
config = PostChangeConfigOptions(LogoID="732440996", Text="Hello World")
print(CoolText(config).create())
Running the example:
python main.py
The script will print a URL where the rendered image can be downloaded.
Configuration and API details
PostChangeConfigOptions(defined inmodules.py) exposes the familiar CoolText form fields:LogoID,Text,FontSize,FileFormat,BackgroundColor_color, and many optional color/boolean/integer fields. The model uses sensible defaults fromconstants.DefaultValueswhen values are not provided.CoolText.create()workflow:- Loads the logo metadata and defaults from
logo-id.json. - Fetches the CoolText logo page (to satisfy referer/session expectations).
- Posts the combined payload to CoolText's
/PostChangeendpoint. - Parses and returns the render URL from the JSON response.
- Loads the logo metadata and defaults from
If the request fails or a response cannot be parsed, create() returns None and logs a message via the logging module.
How to find a LogoID
Just hop on to https://cool-text-thehritu.vercel.app for list of logos and their ids and other configs.
Development
- Run the example locally (
python main.py). - Add or modify
PostChangeConfigOptionsinmodules.pyif you need to support additional CoolText parameters. - Logging is used for error and debug messages; enable or configure the
loggingmodule in your own scripts as needed.
Files
Contributing
Contributions are welcome. Open an issue or submit a pull request with a clear description of the change.
License
This project does not include an explicit license file. Add a LICENSE if you wish to define reuse terms.
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 pycooltext_api-0.1.0.tar.gz.
File metadata
- Download URL: pycooltext_api-0.1.0.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dec90a7580842ab289a7150cc7295c598d57bcc2e1e968c6b38690fcb635ff30
|
|
| MD5 |
be9405aa069e0719748cfe481e49c636
|
|
| BLAKE2b-256 |
3b8b74c19d53afc5b8887437e83419b842f8fbd95384914bb0a7eb61f3a5532b
|
File details
Details for the file pycooltext_api-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pycooltext_api-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc139b7f8cef8198ec65a94c9a6a5f90c8591f07b710104c568400f71eca8c45
|
|
| MD5 |
9ecf3638987b6ce610628032a32cc590
|
|
| BLAKE2b-256 |
f0e0953a3a6a4ac2af5ece8246989cd317589390e3cc0ec0e2366b95c7de6511
|