Skip to main content

A library for using text-based CAPTCHAs from http://textcaptcha.com/.

Project description

TextCaptcha

A Python library for using text-based CAPTCHAs from http://textcaptcha.com/.

This is a simple wrapper around the TextCaptcha API which is a service which provides text-based CAPTCHA questions which helps to prevent spam from robots.

This is designed to be implemented into a server-side application such as a Discord Bot, IRC, SMS, etc...

Note: The TextCaptcha API is only suitable for low traffic websites. For more than 5 requests per second, your usage will be rate limited.

Installation

Use pip to install on all systems:

pip install textcaptcha

Usage Example

This example will ask a CAPTCHA question and ask for an answer which is then checked against the actual answer.

import textcaptcha

# Create a captcha fetcher to fetch captcha questions from the API
fetcher = textcaptcha.CaptchaFetcher()
# Fetch a new captcha from the API
captcha = fetcher.fetch()

# Print the captcha question to the console
print(captcha.question)
# Get a response from the user
answer = input("Answer: ")

# Check that the answer is correct
if captcha.check_answer(answer):
    print("You're not a robot!")
else:
    print("You are a robot, sorry!")

Development Setup

This project uses Poetry to manage dependencies and packaging. Here are the installation instructions for Poetry.

Contributing

  1. Fork it (https://github.com/jake-walker/pytextcaptcha/fork)
  2. Create your feature branch (git checkout -b feature/foobar)
  3. Commit your changes (git commit -am "Add some foobar")
  4. Push to the branch (git push origin feature/foobar)
  5. Create a new pull request

Project details


Release history Release notifications

This version

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for textcaptcha, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size textcaptcha-0.1.0-py3-none-any.whl (15.8 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size textcaptcha-0.1.0.tar.gz (15.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page