Skip to content

captcha-api/keptcha-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keptcha py

keptcha is an API wrapper (python) for captcha-api. Provides both Synchronous and Asynchronous interfaces to interact with the API.

Installation

pip install keptcha

OR using git

pip install git+https://github.com/captcha-api/keptcha-py

Usage

keptcha supports both Sync and Async usage.

Sync

from keptcha import Captcha

my_captcha = Captcha.new()
my_captcha.decode()

if my_captcha.verify("1337H4kOr"):
    print("You are not a bot!")

Async

from keptcha import AsyncCaptcha

my_captcha = await AsyncCaptcha.new()
await my_captcha.decode()

if (await my_captcha.verify("1337H4kOr")):
    print("You are not a bot!")

Configuration

You can pass some keyword arguments to personalize your captcha.

my_captcha = Captcha.new(height=100, width=250, circles=100, length=5)

How to handle bad input?

You can do exception handling.

from keptcha.errors import IncorrectCaptcha

try:
    my_captcha.verify("bad input")
except IncorrectCaptcha:
    print("sir you suck")

Contributing

Feel free to submit a pull request. We very much appreciate it!

License

Licenced under MIT.