Captcha¶
The BotCity Captcha plugin allows you to easily integrate AntiCaptcha and DeathByCaptcha services into your Bot.
Important
This plugin requires a subscription to one of the services mentioned above.
BotCity does not offer any API keys or other credentials for the services.
Installation¶
pip install botcity-captcha-plugin
AntiCaptcha¶
Importing the Plugin¶
After you installed this package, the next step is to import the package into your code and start using the functions.
from botcity.plugins.captcha import BotAntiCaptchaPlugin
Instantiate the Plugin¶
# Instantiate the plugin
anti_captcha = BotAntiCaptchaPlugin(API_KEY)
Solving Text Image Captcha¶
# Solve the captcha
text = anti_captcha.solve_text("captcha_ms.jpeg")
Solving ReCaptcha¶
# Website URL
url = 'https://www.google.com/recaptcha/api2/demo'
# ReCaptcha site key
site_key = '6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-'
# Solve the ReCaptcha
token = anti_captcha.solve_re(url, site_key)
Reporting Incorrect Answers¶
# Report last captcha as incorrect
anti_captcha.report()
DeathByCaptcha¶
Importing the Plugin¶
After you installed this package, the next step is to import the package into your code and start using the functions.
from botcity.plugins.captcha import BotDeathByCaptchaPlugin
Instantiate the Plugin¶
# Instantiate the plugin
death_by_captcha = BotDeathByCaptchaPlugin("USERNAME", "PASSWORD")
Solving Text Image Captcha¶
# Solve the captcha
text = death_by_captcha.solve("captcha.jpg")
Reporting Incorrect Answers¶
# Report last captcha as incorrect
death_by_captcha.report()