Created
November 26, 2014 02:51
-
-
Save tonyseek/619a1bb14905350272f8 to your computer and use it in GitHub Desktop.
A example of wheezy.captcha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
from wheezy.captcha.image import captcha | |
from wheezy.captcha.image import background | |
from wheezy.captcha.image import curve | |
from wheezy.captcha.image import noise | |
from wheezy.captcha.image import smooth | |
from wheezy.captcha.image import text | |
from wheezy.captcha.image import offset | |
from wheezy.captcha.image import rotate | |
from wheezy.captcha.image import warp | |
captcha_image = captcha(drawings=[ | |
background(), | |
text(fonts=['/path/to/font.ttf'], | |
drawings=[warp(), rotate(), offset()]), | |
curve(), | |
noise(), | |
smooth(), | |
]) | |
characters = 'adefhjkmnprstuvwxyABDEFHJKLMNPRSTUVWXY34578' | |
def show(): | |
chars = random.sample(characters, 5) | |
captcha_image(''.join(chars)).show() | |
show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment