No project description provided
Project description
CAPCHA Library (Python)
A Python library designed to implement CAPCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) functionality in web applications. This library is lightweight, flexible, and aims to provide a reliable solution for preventing automated bot attacks on your web forms.
Features
- Easy Integration: Seamlessly integrate CAPTCHA challenges into your web forms with minimal effort.
- Customization: Customize the appearance and complexity of CAPTCHAs to suit your application's needs.
- Security: Generate secure and random challenges to effectively thwart automated bots.
- Accessibility: Prioritize user accessibility by incorporating accessibility features into the CAPTCHA design.
- Compatibility: Compatible with various Python web development frameworks.
Installation
Install the library using pip:
pip install capcha
## Usage Example
from capcha import Capcha
from flask import Flask, render_template, request
app = Flask(__name__)
captcha = Capcha()
@app.route('/')
def index():
# Генерация CAPTCHA при загрузке страницы
captcha_image = captcha.generate()
return render_template('index.html', captcha_image=captcha_image)
@app.route('/submit', methods=['POST'])
def submit():
user_entered_captcha = request.form.get('captcha')
expected_captcha = # получите ожидаемое значение из вашего хранилища данных
is_valid_captcha = captcha.validate(user_entered_captcha, expected_captcha)
if is_valid_captcha:
# Продолжить с отправкой формы
pass
else:
# Вывести сообщение об ошибке пользователю
pass
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
capcha-3.2.tar.gz
(1.3 MB
view hashes)
Built Distribution
capcha-3.2-py3-none-any.whl
(1.3 MB
view hashes)