Swarmauri Tool Captcha Generator
Tool that generates CAPTCHA images from text using the captcha library. Returns the rendered PNG as a base64-encoded string so it can be stored or embedded inline.
Features
- Accepts a single parameter (
text) and produces an ImageCaptcha output. - Returns a dictionary with
image_b64containing the PNG bytes encoded as base64. - Can be wired into larger Swarmauri toolchains to produce human challenges dynamically.
Prerequisites
- Python 3.10 or newer.
- Pillow and captcha dependencies (installed automatically with this package).
Installation
# pip
pip install swarmauri_tool_captchagenerator
# poetry
poetry add swarmauri_tool_captchagenerator
# uv (pyproject-based projects)
uv add swarmauri_tool_captchagenerator
Quickstart
import base64
from pathlib import Path
from swarmauri_tool_captchagenerator import CaptchaGeneratorTool
captcha_tool = CaptchaGeneratorTool()
result = captcha_tool("Verify42")
image_b64 = result["image_b64"]
image_bytes = base64.b64decode(image_b64)
Path("captcha.png").write_bytes(image_bytes)
Displaying inline (e.g., in a HTML response):
html = f"<img src='data:image/png;base64,{image_b64}' alt='captcha' />"
Tips
- Customize CAPTCHA rendering (fonts, size) by subclassing and configuring
ImageCaptcha(e.g.,ImageCaptcha(width=280, height=90)). - Store the generated solution (
Verify42in the example) securely server-side to validate client responses later. - For high throughput, reuse the tool instance rather than instantiating per request to avoid repeated font loading overhead.
Want to help?
If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.
Metadata
Release files for swarmauri_tool_captchagenerator 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swarmauri_tool_captchagenerator-0.10.0.tar.gz | 7.2 kB | Without provenance | Details for swarmauri_tool_captchagenerator-0.10.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swarmauri_tool_captchagenerator-0.10.0-py3-none-any.whl | Python 3 | none | any | Details for swarmauri_tool_captchagenerator-0.10.0-py3-none-any.whl |
Total release size: 15.5 kB
Release files / swarmauri_tool_captchagenerator-0.10.0.tar.gz
| Download URL | swarmauri_tool_captchagenerator-0.10.0.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
204f4020b9bafe85160cd621ff3eeea6ccaf96b58125f0c4bf9ed740f8d10783
|
|
BLAKE2b-256 checksum How to use checksums |
6eef261c3404bc604366d47ff87f071bbb6b453718e7f98289987490e076eb07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / swarmauri_tool_captchagenerator-0.10.0-py3-none-any.whl
| Download URL | swarmauri_tool_captchagenerator-0.10.0-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dedfbed0769a628cd63f32e0444018bde1a269061a191687d75e0cf3832fe412
|
|
BLAKE2b-256 checksum How to use checksums |
ff4638f0b4368d4b6f18a1bc344815471b935ec33e0f6e7a1df51a09414b9c78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for swarmauri_tool_captchagenerator 0.10.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.