Skip to content

Latest commit

 

History

History
65 lines (51 loc) · 2.81 KB

File metadata and controls

65 lines (51 loc) · 2.81 KB

Arcaptcha GitHub PyPI

Validate and display captcha from Arcaptcha easily in Python. (PyPI)

Installation

Install using pip:

pip install arcaptcha-python

Install manually:

git clone git@github.com:arcaptcha/arcaptcha-python.git

cd arcaptcha-python

sudo python setup.py install

Usage

Before doing anything, please read the documentation.

>>> from arcaptcha_python import Arcaptcha
>>> # Create a new instance of Captcha object
>>> captcha = Arcaptcha.Captcha(site_key = "my_site_key", secret_key = "my_secret_key")
>>> # Verify challenge
>>> captcha.verify(response = "example_challenge_id")
True
>>> # Display API script tag
>>> captcha.display_tag()
"<script src='https://widget.arcaptcha.co/2/api.js' async defer></script>"
>>> # Display captcha HTML tag
>>> captcha.displayCaptcha()
'<div class="arcaptcha" data-site-key="my_site_key" data-size="normal" data-theme="light" data-lang="fa"></div>'

Functions

You can use the following functions with captcha:

Function Parameters Description
display_tag() Display ARCaptcha javascript resource HTML code.
displayWithColor() color | Required Display captcha HTML code with color
displayWithLang() lang | Optional(default: fa) Display captcha HTML code with language
displayWithTheme() theme | Optional(default: light) Display captcha HTML code with theme
displayWithCallBack() callback | Required Display captcha HTML code with callback
displayWithSize() size | Optional(default: normal) Display captcha HTML code with size
displayCaptcha() size, callback(default: None), theme, color(default: None),lang Display captcha HTML code with all parameter.