Django / Rest Framework Captcha
Project description
Redj Captcha
Django / Rest Framework captcha Safe, flexible and easy to use
Getting Started
in
setting.py:
INSTALLED_APPS = [
...
'redjcaptcha',
]
in terminal python manage.py migrate
in
urls.py: and :
from django.urls import path, include
urlpatterns = [
...
path('', include('redjcaptcha.urls')),
]
and check check http://localhost:8000/captcha
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 Logpakeg:
from redjcaptcha import redjlog
redjlog.fullCheckCaptcha(request)
change default setting:
from redjcaptcha.setup import init
init(
size=6, => count of word
debug=True, => disable captcha
font_size=50, => font size
timeout=6000, => expire captcha after 6000s
type="str-int", => type of captcha : int | str | str-int
image_height=70, => image height
image_weight=180, => image weight
text_color="random", => text color (defualt random)
pre_request_inVmin= 10, => max request in 5 minits
background_color="#fff" => background image
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Redj Captcha-1.1.5.tar.gz.
File metadata
- Download URL: Redj Captcha-1.1.5.tar.gz
- Upload date:
- Size: 5.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6665d9e6c91ea02ff078f89e59559b03765b5b19450c86be506ebcd9a8187895
|
|
| MD5 |
29b5e3a61b4927e9124f6688c681576a
|
|
| BLAKE2b-256 |
b90a4a717ff9c4156de634e049d1b1d567e2c16a9a22bc7d749cdfa35c9c9ee3
|
File details
Details for the file Redj_Captcha-1.1.5-py3-none-any.whl.
File metadata
- Download URL: Redj_Captcha-1.1.5-py3-none-any.whl
- Upload date:
- Size: 7.9 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8837158c82d738c125601c9458bfcfe1ef393ea4c609530401c69174fe2be10f
|
|
| MD5 |
4ce956d4bd29bc25d66d32100eba411c
|
|
| BLAKE2b-256 |
5c25a154e6ce930230a1cf198ebee3435276034d4db7e47af85821013d7b7963
|