Skip to main content

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 flaskrecaptcha

Implemetação

from flask import Flask
from google_recaptcha_flask import ReCaptcha

app = Flask(__name__)

GOOGLE_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"
))

GOOGLE_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

EasyFlaskRecaptcha-0.0.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

EasyFlaskRecaptcha-0.0.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file EasyFlaskRecaptcha-0.0.1.tar.gz.

File metadata

  • Download URL: EasyFlaskRecaptcha-0.0.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for EasyFlaskRecaptcha-0.0.1.tar.gz
Algorithm Hash digest
SHA256 39173c9ec9e355675f1ae4b2648376ff453065d4c4cc7d17fcf8606ebb1f0d80
MD5 2d9d1c7811975bc6c71f64c27eb251fd
BLAKE2b-256 4b6745333bba4095283ade1f092a7ddf3df4b6b0e7672e4c6a022083ace12c56

See more details on using hashes here.

File details

Details for the file EasyFlaskRecaptcha-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for EasyFlaskRecaptcha-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72a0c3a673438e4e063b7317e21d7c7d147495047667c6464efc08ffb00a8296
MD5 e4c86372bca3468a29c5ceea2e5d1721
BLAKE2b-256 ba1526366ef602ac29c0b03dc286f80c26faedcf2e8474bbca3b04412de303cd

See more details on using hashes here.

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