Skip to content

Instantly share code, notes, and snippets.

@tonyseek
Created November 26, 2014 02:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonyseek/619a1bb14905350272f8 to your computer and use it in GitHub Desktop.
Save tonyseek/619a1bb14905350272f8 to your computer and use it in GitHub Desktop.
A example of wheezy.captcha
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