Skip to main content

A Python wrapper for the CoolText.com image generation API

Project description

pycooltext-api

A Python wrapper for the CoolText.com image generation API. Build typed payloads, post to CoolText's /PostChange endpoint, and get back a rendered image URL — all in a few lines of code.

Installation

pip install pycooltext-api

Quick Start

from cooltext import CoolText, PostChangeConfigOptions

config = PostChangeConfigOptions(LogoID="732440996", Text="Hello World")
result = CoolText(config).create()

print(result)           # prints the image URL
result.download()       # saves the image locally

Browse Available Logos

Visit https://thehritu.github.io/CoolText/ to browse all available logo styles and their IDs.

Configuration

PostChangeConfigOptions accepts these fields:

Field Type Default Description
LogoID str required ID of the CoolText logo style
Text str "Cool Text" Text to render
FontSize str "70" Font size
FileFormat str "PNG" Output format
BackgroundColor_color str "FFFFFF" Background colour (hex)
Color1_color str None Primary text colour
Color2_color str None Secondary colour
Boolean1Boolean3 str None Logo-specific toggles
Integer1Integer14_color str None Logo-specific numeric options

Get default configuration values for a logo:

Returns a dictionary of all default values for the given logo id

from cooltext import CoolText, PostChangeConfigOptions

config = PostChangeConfigOptions(LogoID="2975689126")
defaults = CoolText(config).get_defaults()
print(defaults)

CoolTextResult

CoolText.create() returns a CoolTextResult object:

result = CoolText(config).create()

str(result)                               # the image URL as a string
bool(result)                              # False if the request failed
result.download()                         # save to current directory
result.download("out.png")                # save to a specific path
result.download("out.png", stream=False)  # disable streaming

Finding a Logo ID

Go to https://thehritu.github.io/CoolText/ — every logo is listed with its ID and default configuration values.

Search for logos by keyword:

Search for logos on cooltext.com by keyword:

from cooltext import CoolTextSearch
results = CoolTextSearch().search("gold") # list of CoolTextSearchResult
for result in results:
    print(result.title, " - ", result.link)
    print(result.to_dict())  # get title and link as a dictionary

CoolTextSearchResult

CoolTextSearch.search() returns a list of CoolTextSearchResult objects.

CoolTextSearchResult has these attributes:

  • title: The logo's title (e.g. "Gold Text")
  • link: The URL to the logo's page on CoolText.com

CoolTextSearchResult has these methods:

  • to_dict(): Returns a dictionary with the title and link
from cooltext.modules import CoolTextSearchResult

result = CoolTextSearchResult("Gold Text", "https://cooltext.com/Logo-ID/1234567890")
print(result.title)  # "Gold Text"
print(result.link)   # "https://cooltext.com/Logo-ID/1234567890"
print(result.to_dict())  # {"title": "Gold Text", "link": "https://cooltext.com/Logo-ID/1234567890"}

Links

License

MIT © TheHritu

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

pycooltext_api-0.1.3.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycooltext_api-0.1.3-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file pycooltext_api-0.1.3.tar.gz.

File metadata

  • Download URL: pycooltext_api-0.1.3.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for pycooltext_api-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c1e1597bf78e1c6d0fd55b470659f691a68f0d92e7938fe8b185bbbce94cca8b
MD5 4beefc71803451a38beeb78c03f545cc
BLAKE2b-256 1ddd4d646eea0803a84766b80f0dbf7d617af986a5a2637a178a145865416aa9

See more details on using hashes here.

File details

Details for the file pycooltext_api-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pycooltext_api-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for pycooltext_api-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9d3dafbe2023230b08c0a6b076f74ca17939d8198410837dcc7d506af3658202
MD5 7c1b3461fdbecd5af50a6e42ee5b5b4e
BLAKE2b-256 f2ba394f15ce92f670071802abc97f1c66ddefdf1a6296897851e37d232adbea

See more details on using hashes here.

Supported by

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