A simple CAPTCHA image generator.
This module provides a single class (Claptcha) that can create on the fly PIL Image instances, BytesIO objects or save image files containing a simple CAPTCHA strings. Its build on top of Pillow package.
It is required that user provides a TTF file with font to be used in images and either a string with CAPTCHA text or a callable object returning strings to be used in images.
Examples:
>>> from claptcha import Claptcha
>>>
>>> # Initialize Claptcha object
>>> c = Claptcha("Text", "FreeMono.ttf")
>>>
>>> # Create a PIL Image object, return it and provided text
>>> c.image
('Text', <PIL.Image.Image image mode=RGB size=200x80 at 0xB741406C>)
>>>
>>> # Create a BytesIO object, return it and provided text
>>> c.bytes
('Text', <_io.BytesIO object at 0xb71e87dc>)
>>>
>>> # Save image in 'claptcha.png' file, return its path and provided text
>>> c.write('claptcha.png')
('Text', 'test.png')
>>>
>>> def captchaStr():
... return "TextFromFunc"
...
>>> # Redefine c: change its size to 100x30, use bicubic resampling filter
>>> # and add white noise
>>> from PIL import Image
>>> c = Claptcha(captchaStr, "FreeMono.ttf", (100,30),
... resampling=Image.BICUBIC, noise=0.3)
>>> c.image
('TextFromFunc', <PIL.Image.Image image mode=RGB size=100x30 at 0xB73EE66C>)
Metadata
Release files for claptcha 0.3.3
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 |
|---|---|---|---|---|
| claptcha-0.3.3.tar.gz | 5.2 kB | Without provenance | Details for claptcha-0.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| claptcha-0.3.3-py3-none-any.whl | Python 3 | none | any | Details for claptcha-0.3.3-py3-none-any.whl |
Total release size: 13.1 kB
Release files / claptcha-0.3.3.tar.gz
| Download URL | claptcha-0.3.3.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5669abc1b15ff5e0f2b9beda932ddbfaa7f5d1b58f1f2d823fdcecabca6a3cc
|
|
BLAKE2b-256 checksum How to use checksums |
be0e7bc63916ec15940634d1ea294c510e0c0a338945e09a0ca805fd4749f9dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / claptcha-0.3.3-py3-none-any.whl
| Download URL | claptcha-0.3.3-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0b25b2c0cf95100f7c45eadf85eb083a9df56dad50354918ce336f68a9144fb2
|
|
BLAKE2b-256 checksum How to use checksums |
5c871464bcc3257bc4e9acbd48346366e3f00f7b4f688843799b2841a9b92332
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for claptcha 0.3.3
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.