ADV-Math-captcha
An advanced mathematical captcha for simple human verification.
How to use
This is an example to make an verification:
from adv_math_captcha import Captcha
if __name__ == '__main__':
formula1 = Captcha(5, 4, 15, 10, 50, 5, 5)
inp = input("Solve this simple question: {0} = ".format(formula1.formula_str))
if formula1.verify(float(inp)):
print("Verify success!")
else:
print("Verify failed! The correct answer is {0:.0f}!".format(float(formula1.evaluation)))
Usage
This module only provides one class with only one method. To make a captcha, just use Captcha(difficulty, term, number_range), which is the shortest form. If you wanna use more parameters, use Captcha(difficulty, term, number_range, factor_range, exponentiation_range, exp_base_range, exp_index_range)
Details: (All the parameters are integers)
difficulty: Decides the difficulty of the generated expression. Valid value is 1-5 in integer.1: Only additions2: Additions and subtractions3: Operations in2, with Mutliplications and divisions (For divisions, the result will always be an integer)4: Operations in3, with exponentiation calculations5: Operations in4, with logarithm calculations (The result will always in simple form to insure the result is reducable, for example, 'ln(e^3)', 'log_2 (8)')
term: Determines how many items will appear in an expression. Althogh there is no limits, don't be too much, or it will be hard to get the answer. :) (P.S. an division will be counted as one item. E.g. (6 / 3) )number_range: Determines the range of the coefficient.factor_range: Determines the range of division results and dominators. Default value is 10.exponentiation_range: Determines the range of exponential calculation. Default value is 50.exp_base_range: Determines the range of base number. Default value is 6.exp_index_range: Determines the range of index number. Default value is 5.
Once you initialized an captcha object, you can get the expression string from Captcha.formula_str variable in class, or make an verification using the Captcha.verify(user_input). A True will be returned if the verification is successful, or False if failed.
You can also get the actual value of the expression from Captcha.evaluation variable.
About
If you want to contact me, mail to mailto
Metadata
Release files for adv-math-captcha-ostrichb 0.9.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| adv_math_captcha_ostrichb-0.9.10-py3-none-any.whl | Python 3 | none | any | Details for adv_math_captcha_ostrichb-0.9.10-py3-none-any.whl |
Release files / adv_math_captcha_ostrichb-0.9.10-py3-none-any.whl
| Download URL | adv_math_captcha_ostrichb-0.9.10-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b09cdcf3b32cc68049bc44af44c4d0beea6ae74b395f691d5c6be9588d3071a1
|
|
BLAKE2b-256 checksum How to use checksums |
741ea960da67084b9830cb8cbee06cbe1c18919e74599b5c1db2a2aefd5404b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Security for adv-math-captcha-ostrichb 0.9.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.