Easy Integration of Google Recaptcha in Flask
Project description
EasyFlaskRecaptcha
EasyFlaskRecaptcha is a python Module which makes Google Recaptcha Integration in flask application easy
Installation
pip install EasyFlaskRecaptcha
Implementation
from flask import Flask
from EasyFlaskRecaptcha import ReCaptcha
app = Flask(__name__)
recaptcha = ReCaptcha(app)
app.config.update(dict(
GOOGLE_RECAPTCHA_ENABLED=True,
GOOGLE_RECAPTCHA_SITE_KEY="6Lf74pUpXXXXXXXXXXXXXXXi012KXXXX7KB-31XXXH",
GOOGLE_RECAPTCHA_SECRET_KEY="6LXXXXXXXXXXAFX-ZAXXXXXGSd-y5g0o-JZXXXXB"
))
recaptcha.init_app(app)
Flask Template Usage Example (Frontend)
Description: Use {{ recaptcha }} Tag inside form tag
<form method="post" action="/submit">
...
{{ recaptcha }}
[submit]
</form>
Flask Backend Route Example
@route("/submit", methods=["POST"])
def submit():
if recaptcha.verify():
print("SUCCESS")
else:
print("FAILED")
More Settings
GOOGLE_RECAPTCHA_ENABLED = True
GOOGLE_RECAPTCHA_SITE_KEY = ""
GOOGLE_RECAPTCHA_SECRET_KEY = ""
GOOGLE_RECAPTCHA_THEME = "light"
GOOGLE_RECAPTCHA_TYPE = "image"
GOOGLE_RECAPTCHA_SIZE = "normal"
GOOGLE_RECAPTCHA_LANGUAGE = "en"
GOOGLE_RECAPTCHA_RTABINDEX = 10
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
Built Distribution
Close
Hashes for EasyFlaskRecaptcha-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a6fa6adac938bf9521a70438cf499c3f493ddf8482e4130087a66a32acf0016 |
|
MD5 | 5953182c5e898cb3ce47d6d267e0e3f0 |
|
BLAKE2b-256 | 0d5525ca8f744ac48c40b28d3c56f9433d5c12f58d4d7bd9c3c878dbc2fb2f66 |