Django验证码库 DjangoCaptcha

码农软件 · 软件分类 · 验证码(Captcha) · 2019-04-22 11:57:33

软件介绍

在django中生成英文单词验证码,提供验证码图片生成,检查验证码等功能 原用于pythoner.net的验证码,现整理出来打包发布到pypi.

新特性

  • 新增数字验证码模式
  • 字体尺寸根据图片长宽自适应

Usage

Install

pip install DjangoCaptcha
or
easy_install DjangoCaptcha

Display(views.py)

from DjangoCaptcha import Captcha
def code(request):
    ca =  Captcha(request)
    ca.words = ['hello','world','helloworld']
    ca.type = 'number'
    return ca.display()

Check user input(views.py)

from DjangoCaptcha import Captcha
def index(request):
    _code = request.GET.get('code') or ''
    if not _code:
        return render('index.html',locals())

    ca = Captcha(request)
    if ca.check(_code):
        return HttpResponse('验证成功')
    else:
        return HttpResponse('验证失败')

Custom

width of image

ca.img_width = 150

height of image

ca.img_height = 30

type fo code ('number'/'word')

ca.type = 'number'

Rely on

  • PIL

More

本文地址:https://codercto.com/soft/d/4132.html

我看电商

我看电商

黄若 / 电子工业出版社 / 2013-6-1 / 39.00元

本书是作者近30年从事及电子商务管理的总结和分享。 近年来电商行业在中国迅猛发展,2012年网络市场规模达到13,000亿人民币,诞生了淘宝、天猫、京东、、凡客、唯品会……等一大批全新的网络公司,电子商务正在日益深入的影响着越来越多人的生活。同时,这个行业连年亏损,顾客服务良莠不齐,也广为人们所关注。作者从地面到电子商务,从跨国公司高管到管理民营企业,从开创天猫模式到带领上市,被业界称为中国......一起来看看 《我看电商》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试