Python生成验证码的框架
Project description
zdppy_captcha
python用于生成图片,声音等验证码的底层框架
安装
pip install zdppy-captcha
使用教程
显示图片验证码
# 生成图片验证码
import random
from zdppy_captcha.image import ImageCaptcha
# 生成随机字符串
code = random.sample('abcdefghijklmnopqrstuvwxyz1234567890', 4) # 随机选取4个不重复字符串,返回一个列表
# 生成图片验证码对象
image = ImageCaptcha()
# 第一种使用方式:生成图片验证码
im = image.generate_image(code)
im.show() # 可以直接展示图片
保存验证码图片
# 生成图片验证码
import random
from zdppy_captcha.image import ImageCaptcha
# 生成随机字符串
code = random.sample('abcdefghijklmnopqrstuvwxyz1234567890', 4) # 随机选取4个不重复字符串,返回一个列表
# 生成图片验证码对象
image = ImageCaptcha()
# 第二种使用方式:生成图片验证码并保存
image.write(code, 'zdppy_captcha.jpg')
将验证码转换为bytesio
# 生成图片验证码
import random
from zdppy_captcha.image import ImageCaptcha
# 生成随机字符串
code = random.sample('abcdefghijklmnopqrstuvwxyz1234567890', 4) # 随机选取4个不重复字符串,返回一个列表
# 生成图片验证码对象
image = ImageCaptcha()
# 第三种使用方式:生成图片验证码BytesIO
data = image.generate(code)
print(data, type(data))
生成base64图片
import zdppy_captcha as captcha
# 获取验证码以及base64图片
code, img = captcha.get_base64(6)
print(code)
print(img)
版本历史
v0.1.0
- 基本用法
v0.1.2
- get_base64生成key,code和img
v0.1.3
- 新增zdppy_api.get方法
v0.1.4
- 支持zdppy低代码开发
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
zdppy_captcha-0.1.4.tar.gz
(105.2 kB
view details)
Built Distribution
zdppy_captcha-0.1.4-py3-none-any.whl
(107.7 kB
view details)
File details
Details for the file zdppy_captcha-0.1.4.tar.gz
.
File metadata
- Download URL: zdppy_captcha-0.1.4.tar.gz
- Upload date:
- Size: 105.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.8.19 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5355bdcb815bf4992d4ac3eb2120a4acdfa783433123866f7d68edf04b17d686 |
|
MD5 | 453064ecf672f10d354b85a893564368 |
|
BLAKE2b-256 | 8f8b37378b9650fedf044fe23c9260a09b8e6d882cb2420ba75754b814557338 |
File details
Details for the file zdppy_captcha-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: zdppy_captcha-0.1.4-py3-none-any.whl
- Upload date:
- Size: 107.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.8.19 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0449093b25a6f7bb9bbcf6f8aab382af71df383bc8f6c811965e43f19b08dfde |
|
MD5 | ee465cd7d1d74612558b92c60c2829c3 |
|
BLAKE2b-256 | dbe3b7393bf53df8f19180771b19751c82bd3c07b7b793a6c382daf6563847c3 |