Skip to main content

A professional, pluggable CAPTCHA library with image, math, and custom challenge types, token-based security, and multiple storage backends.

Project description

InnoCaptcha


🚀 Project Identity & Versioning

Badge Type Markdown Code
PyPI Version PyPI Version
GitHub Release GitHub Release
GitHub Tag GitHub Tag
License License: MIT
PyPI Status PyPI Status

📊 Stats & Downloads

Badge Type Markdown Code
Total Downloads (Pepy) Total Downloads
Monthly Downloads (Pepy) Monthly Downloads
Weekly Downloads (Pepy) Weekly Downloads
PyPI Downloads (Daily) PyPI Downloads
PyPI Downloads (Weekly) PyPI Downloads
PyPI Downloads (Monthly) PyPI Downloads

🛠️ Activity & Development

Badge Type Markdown Code
Last Commit GitHub last commit
Commit Activity (Yearly) GitHub commit activity
Contributors GitHub contributors
Repo Size GitHub repo size
Code Size GitHub code size in bytes
Top Language GitHub top language
Language Count GitHub language count

✨ Quality & Testing

Badge Type Markdown Code
Build Status Build Status
Coverage Coverage
Code Quality Code Quality
Typing Typing
PyPI Types PyPI - Types

🐍 Environment & Compatibility

Badge Type Markdown Code
Python Versions Python Versions
PyPI Implementation PyPI Implementation
PyPI Wheel PyPI Wheel
PyPI Format PyPI Format

🤝 Community & Social

Badge Type Markdown Code
GitHub Stars GitHub stars
GitHub Forks GitHub forks
GitHub Watchers GitHub watchers
GitHub Followers GitHub followers
GitHub Discussions GitHub Discussions

🛠️ Support & Maintenance

Badge Type Markdown Code
Open Issues GitHub issues
Closed Issues GitHub issues-closed
Open PRs GitHub pull requests
Closed PRs GitHub pull requests-closed
Milestones GitHub milestones

Structured Egyptian geographical and timezone data for Python.

Provides a complete, offline dataset of Egyptian governorates, cities, landline and mobile area codes, and timezone utilities — with zero dependencies (uses Python standard library only).

View on GitHub | View on PyPI


Installation

pip install InnoCaptcha

Quick Start

Image CAPTCHA Generation

Generate custom image-based CAPTCHA with configurable text, colors, size, and fonts.

from InnoCaptcha.image import generate_captcha

# Generate a simple CAPTCHA and save it to the current directory
result = generate_captcha("A1b2C3")
print(result)  # {'file_path': '/current/path/captcha.png', 'chars': 'A1b2C3'}

# Save to a specific folder with custom colors and size
result = generate_captcha(
    chars="7Xk9P",
    path="/tmp/captchas",
    format="png",
    bg_color=(255, 255, 255),      # white background
    fg_color=(50, 150, 200),        # blue text
    width=240,
    height=80
)

generate_captcha()

Parameter Type Default Description chars str required The text to render in the CAPTCHA image. path str or None None Directory where the image will be saved. If None, saves to the current working directory. format str 'png' Image format (e.g., 'png', 'jpeg', 'gif'). bg_color tuple of 3 int (RGB) or None random light color Background color. If None, a random light color is chosen. fg_color tuple of 3 or 4 int (RGB/RGBA) or None random dark color Foreground (text) color. If None, a random semi‑transparent dark color is generated. width int or None 160 Image width in pixels. If None, uses default (160). height int or None 60 Image height in pixels. If None, uses default (60). fonts list of font paths or None built‑in fonts List of TrueType font file paths to use for text rendering. font_sizes tuple of int or None (42, 50, 56) Font sizes to randomly pick from.

Returns a dictionary:

{
    'file_path': str,   # full path to the saved image file
    'chars': str        # the original text that was rendered
}

Additional Functions

· generate_captcha_image(chars, ...) – returns a PIL.Image object instead of saving it. · generate_captcha_bytes(chars, ...) – returns an in‑memory bytes buffer of the image (useful for serving directly over HTTP).

Example using generate_captcha_bytes:

from InnoCaptcha.image import generate_captcha_bytes
from flask import send_file

buffer = generate_captcha_bytes("XyZ12")
return send_file(buffer, mimetype='image/png')

Notes

· All CAPTCHA images include random distortions (curve, dots, character warping) and anti‑aliasing for better security. · The module uses secrets for cryptographically strong randomness. · For advanced customization, you can pass your own fonts (list of .ttf file paths) and fine‑tune rendering via the module‑level constants (CHARACTER_OFFSET_DX, WORD_SPACE_PROBABILITY, etc.).

Requirements

· Python 3.9 or later (uses standard library zoneinfo; for Python 3.8 you may need the backports.zoneinfo package).


License

MIT - InnoSoft Company

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

innocaptcha-0.0.1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

innocaptcha-0.0.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file innocaptcha-0.0.1.tar.gz.

File metadata

  • Download URL: innocaptcha-0.0.1.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for innocaptcha-0.0.1.tar.gz
Algorithm Hash digest
SHA256 595bfbd20fa1c6ebb9e2226376773fbe6cc9cefdd9c7c11dcf5436db4e5d4ae9
MD5 d1c84531f7a86d5a2c02064402b30411
BLAKE2b-256 5e0dddddfe8b1ba7555085ac9888c93d4ec37760aaa4f711bba2d6b7655c2bcb

See more details on using hashes here.

File details

Details for the file innocaptcha-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: innocaptcha-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for innocaptcha-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5ece92155c078f1e3543882db37147a46394150cbb3c716712e173a6e907eb5a
MD5 de23c20ba464da4817443fa1aff6f0cf
BLAKE2b-256 2275d2cd50ecffcc38faeccba07fd6933abd871b6f7752a1da5033ded746e4fd

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