No project description provided
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
- 基本用法
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.1.tar.gz
(104.1 kB
view details)
Built Distribution
zdppy_captcha-0.1.1-py3-none-any.whl
(106.2 kB
view details)
File details
Details for the file zdppy_captcha-0.1.1.tar.gz
.
File metadata
- Download URL: zdppy_captcha-0.1.1.tar.gz
- Upload date:
- Size: 104.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.7 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6315e0ed1ecce149dff9d73f49e03d4a7eb10bd594c8550b78a9f104ae111345 |
|
MD5 | 70e39ba791413817045ce8a103524ed6 |
|
BLAKE2b-256 | 4d0b5d58564792e804f63f1961d10fdf3b23acfd41b40ecbd330af8422d7a0d8 |
File details
Details for the file zdppy_captcha-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: zdppy_captcha-0.1.1-py3-none-any.whl
- Upload date:
- Size: 106.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.7 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83b49c8b64fb11e17876f9d2f5112779724dba7c05d8ecc9eb5f0084f10d640b |
|
MD5 | 4330f5d9750ddf927aac0e5e8e15da04 |
|
BLAKE2b-256 | 2d724ccce49d94398e1c5e4ae1dbd1442d020a855b1cbb81d7ff7f9a1346b3f4 |