skillfed

captcha

A captcha library that generates audio and image CAPTCHAs.

captcha v0.7.1 392.9K downloads/30d#7,003 on PyPI1,098
Permissive license BSD-3-Clause AGING released

What it is and what it does

Captcha is a library for generating audio and image CAPTCHAs—challenge-response tests used to verify that a user is human rather than a bot. It provides two separate modules: one for audio CAPTCHAs and one for image CAPTCHAs, each accepting a string to encode and outputting either a WAV file or PNG image. The library depends only on Pillow for image handling and supports Python 3.8 through 3.13.

The package is designed for developers building web applications or other systems that need human verification. It allows you to generate CAPTCHA data in memory or write it directly to files, and supports customization through your own voice and font data, though built-in data is available. The library has been in development since 2014 and remains in beta status; it is permissively licensed under BSD-3-Clause.

Use it for:

  • Generate image CAPTCHAs for web form submission to prevent automated bot attacks.
  • Create audio CAPTCHAs for accessibility compliance when image-based verification alone is insufficient.
  • Build a custom bot-detection layer by embedding CAPTCHA generation into a web service or API.
  • Integrate standalone CAPTCHA generation into a security workflow without relying on third-party services.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Generates audio and image CAPTCHAs for use in web applications and security workflows, with support for custom voice and font data.

Yes, if you need simple, self-hosted CAPTCHA generation without external service dependencies. The low install friction, permissive license, and broad Python version support make it straightforward to adopt. However, the aging maintenance status (last release over a year ago) and beta classification suggest evaluating whether the feature set meets your needs before committing to production use. No known vulnerabilities.

Install

captcha on PyPI

pip

pip install captcha

uv

uv add captcha

poetry

poetry add captcha

Installing captcha

Before you install

Low friction install with a single runtime dependency (Pillow). The package is aging but actively maintained; the repository shows recent commits and no archived status, though the last release was over a year ago.

License in practice

Licensed under BSD-3-Clause, a permissive license that allows commercial and private use with minimal restrictions—suitable for most production deployments.

Quickstart

pip install captcha

from captcha.audio import AudioCaptcha
from captcha.image import ImageCaptcha

audio = AudioCaptcha(voicedir='/path/to/voices')
image = ImageCaptcha(fonts=['/path/A.ttf', '/path/B.ttf'])

data = audio.generate('1234')
audio.write('1234', 'out.wav')

data = image.generate('1234')
image.write('1234', 'out.png')

Requires Pillow as a runtime dependency; audio generation requires voice data files and image generation requires font files (built-in data available but custom data recommended).

Verify before relying

  • Whether built-in voice and font data are sufficient for production use or if custom data is mandatory.
  • Current performance characteristics and scalability limits for high-volume CAPTCHA generation.
  • Whether the package supports modern CAPTCHA variants (e.g., reCAPTCHA integration) or only standalone generation.

Package facts

License BSD-3-Clause (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 1 — Pillow
Maintenance aging — 531 days since the last release
Last repo commit
First released
Downloads 392,931/month — #7,003 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: captcha-0.7.1-py3-none-any.whl

Development Status :: 4 - BetaEnvironment :: ConsoleEnvironment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Security

Tags

captcha generationaudio captchaimage captchabot protectionchallenge-response verificationsecurity verificationhuman verification
bot-protectionaccessibility

More Security packages