Skip to main content

A modular and customizable CAPTCHA generation library.

Project description

CaptchaGenerator 2.0.0

Tests Package Python License

Fast, modular CAPTCHA generation for Python with 26 ready-to-use challenges.

Documentation · Examples · Release 2.0.0

Install

pip install CaptchaGenerator

Audio support:

pip install "CaptchaGenerator[audio]"

Quick Start

from CaptchaGenerator import CaptchaConfig, TextCaptcha

config = CaptchaConfig(width=720, height=240, random_seed=42)

answer = TextCaptcha(config).generate(
    number_gen=6,
    values_captcha="ABCDEFGHJKLMNPQRSTUVWXYZ23456789",
    name_export="captcha",
    path_export="./output",
    fonts=[],
    colors=["navy", "darkred"],
    backgrounds=[],
    difficulty="medium",
    style="modern",
)

print(answer)

Included CAPTCHAs

  • Text: text, random text, words and missing characters
  • Logic: math, sequences, custom questions and visual logic
  • Images: grids, rotation, direction, upside-down objects and click points
  • Puzzles: sliders, irregular pieces, patterns and mazes
  • Visual: clocks, colors, shapes, odd-one-out and 3D perspective
  • Media: animated and audio CAPTCHA

All generators are available through CaptchaGenerator.SUPPORTED_CAPTCHAS.

Customization

Use CaptchaConfig to control dimensions, colors, fonts, output format, quality, accessibility text, random seed and render hooks.

Visual challenges return a ChallengeResult containing:

  • path - generated image
  • answer - expected answer; keep it server-side
  • prompt - user instruction
  • metadata - integration data
  • accessibility_text - accessible description

Examples

Each CAPTCHA has standalone simple and Tkinter examples:

Examples/CaptchaExamples/<CaptchaName>/
  simple.py
  interactive.py

Security

Never expose answers, target coordinates or puzzle solutions to an untrusted client. Validate responses on the server.

License

MIT

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

captchagenerator-2.0.0.tar.gz (51.7 kB view details)

Uploaded Source

Built Distribution

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

captchagenerator-2.0.0-py3-none-any.whl (46.4 kB view details)

Uploaded Python 3

File details

Details for the file captchagenerator-2.0.0.tar.gz.

File metadata

  • Download URL: captchagenerator-2.0.0.tar.gz
  • Upload date:
  • Size: 51.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for captchagenerator-2.0.0.tar.gz
Algorithm Hash digest
SHA256 3d8ae46ab2f242b6d06703c8c8e8610bff96a039582882b302258d9137d1511e
MD5 6c3f3bef1971e2f5ccbf9fa8be0b4b11
BLAKE2b-256 187c757d7c143656a3d91c1cf6665a5a4388b957f63c6bbd39c19737efc30db2

See more details on using hashes here.

File details

Details for the file captchagenerator-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for captchagenerator-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e260f0a83a4b49ca923aa87e606bea9762c3f0d7cb0d33391877386f0d2a17c0
MD5 26e71b1baf4056fdd32727a815b0f38e
BLAKE2b-256 5c82cea7c1c7d2af72c766c14602317a001782ad1f948370a212d49fe87cf308

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