Skip to main content

A Python package for integrating hCaptcha, a popular captcha service, into various applications for enhanced security and user verification.

Project description

hcaptcha

hcaptcha is a Python module (unofficial) that provides an easy-to-use interface for verifying hcaptcha responses using the hcaptcha verification API.

Installation

You can install hcaptcha using pip:

pip install hcaptcha

Usage

To use hcaptcha, you'll need an hcaptcha secret key for your site. You can get one by signing up for an account at hcaptcha website.

from hcaptcha.hcaptcha import HCaptchaVerifier, HCaptchaVerificationError
import asyncio

# Initialize the verifier with your hcaptcha secret key
verifier = HCaptchaVerifier(your_hcaptcha_secret_key)

# Verify an hcaptcha response
# You can use await instead of asyncio.run if you are in a async function
try:
    is_valid = asyncio.run(verifier.verify(user_response_token))
    if is_valid:
        print("Captcha verified successfully.")
    else:
        print("Captcha verification failed.")
except HCaptchaVerificationError as e:
    print(f"Verification failed with error: {str(e)}")

Documentation

Documentation for hcaptcha is available here

Contributing

If you find a bug or have a feature request, please open an issue on GitHub.

Licence

hcaptcha is distributed under the MIT License. See LICENSE for more information.

Project details


Download files

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

Source Distribution

hcaptcha-0.2.1.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

hcaptcha-0.2.1-py3-none-any.whl (3.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page