图形验证码

This commit is contained in:
mkg
2021-08-26 12:12:39 +08:00
parent 233241c962
commit 3c1764e58d
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ def gen_captcha(content='2345689abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWX
""" 生成验证码 """
image = ImageCaptcha()
# 获取字符串
captcha_text = "".join(choices(content, k=4))
captcha_text = "".join(choices(content, k=4)).lower()
# 生成图像
captcha_image = Image.open(image.generate(captcha_text))
return captcha_text, captcha_image