Skip to main content

Redj Captcha

Project description

Redj Captcha

Django / Rest Framework captcha

Getting Started

in setting.py:

INSTALLED_APPS = [
    ...
    'redjcaptcha',
]

in urls.py and check http://localhost:8000/captcha:

from django.urls import path, include

urlpatterns = [
    ...
    path('', include('redjcaptcha.urls')),
]

check Captcha (django):

from redjcaptcha.setup import checkCaptcha

check = checkCaptcha(captcha_key, captcha_value)
if check==False:
    return 'inValid'

or use fullCheckCaptcha for check ip and User-agent

from redjcaptcha.setup import fullCheckCaptcha

check = fullCheckCaptcha(request)
if check==False:
    return 'inValid'

check Captcha (rest_framework):

from rest_framework import serializers
from redjcaptcha.setup import checkCaptcha

class CaptchaSerializer(serializers.Serializer):
    captcha_key = serializers.CharField()
    captcha_value = serializers.CharField()

    def validate(self, data):
        check = checkCaptcha(data['captcha_key'], data['captcha_value'])
        if check==False:
            print('\n=====> Captcha faild')
            raise Exception()

        print('\n=====> Captcha success')
        return check

if use Redj Log pakeg:

from redjcaptcha import redjlog

redjlog.fullCheckCaptcha(request)

change default setting:

from redjcaptcha.setup import init

init(
    size=6,
    debug=True,
    font_size=50,
    timeout=6000,
    type="str-int",
    image_height=70,
    image_weight=180,
    text_color="random",
    background_color="#fff"
)

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

Redj Captcha-1.1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

Redj_Captcha-1.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file Redj Captcha-1.1.0.tar.gz.

File metadata

  • Download URL: Redj Captcha-1.1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for Redj Captcha-1.1.0.tar.gz
Algorithm Hash digest
SHA256 14e17c9983fc6e228ef947e054d02a0350722cb0e5568e78e47f0a4374a1f229
MD5 6675260e77004176b2d02cbff7735211
BLAKE2b-256 9ca34919622bffdc0d743974b2f1bae3dc76a44832b4ba1617d66416d739516b

See more details on using hashes here.

File details

Details for the file Redj_Captcha-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: Redj_Captcha-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for Redj_Captcha-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 215afd5c049ebb690fa1ee9e331b03e7d380cda1f5de627f19cb527e9a5a7a24
MD5 7220d85d69dc2b54aed0e49e793f2fe6
BLAKE2b-256 18e05bf93ec177f96fc36313299adae12c1612791300e993b46db01a76a3aca0

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