Marbaloo ReCaptcha
Google ReCaptcha for cherrypy.
Installation
pip install marbaloo_recaptcha
Usage
# app.py
import cherrypy
import marbaloo_recaptcha
cherrypy.tools.recaptcha = marbaloo_recaptcha.Tool()
class Root(object):
@cherrypy.expose
def index(self, **kwargs):
recaptcha = cherrypy.request.recaptcha
if 'submit_recaptcha' in kwargs:
if recaptcha.verify():
return 'Success'
else:
return 'Fail'
else:
return '''
<head>
%s
</head>
<body>
<form method="post">
%s
<input type="submit" name="submit_recaptcha"/>
</form>
</body>
''' % (recaptcha.get_html_head(), recaptcha.get_html_field(enable_no_script=True))
config = {
'global': {
"server.socket_host": "0.0.0.0",
"server.socket_port": 9095,
},
'/': {
'tools.recaptcha.on': True,
'tools.recaptcha.remoteip': '',
# For production level, uncomment this lines
# 'tools.recaptcha.secret_key': 'MY_SECRET_KEY',
# 'tools.recaptcha.site_key': 'MY_SITE_KEY',
}
}
cherrypy.quickstart(Root(), '/', config)
Advanced Usage:
import cherrypy
import marbaloo_recaptcha
cherrypy.tools.recaptcha = marbaloo_recaptcha.Tool()
class Root(object):
@cherrypy.expose
def index(self, **kwargs):
recaptcha = cherrypy.request.recaptcha
if 'submit_recaptcha' in kwargs:
if recaptcha.verify():
return 'Success'
else:
return 'Fail'
else:
return '''
<head>
%s
</head>
<body>
<form method="post">
%s
<input type="submit" name="submit_recaptcha"/>
</form>
</body>
''' % (recaptcha.get_html_head(defer=True,
async=True,
render='onload',
onload='my_onload_javascript',
hl='fa'),
recaptcha.get_html_field(data_attributes={
'data-theme': 'dark',
'data-size': 'compact',
'data-type': 'image'
},
enable_no_script=True))
config = {
'global': {
"server.socket_host": "0.0.0.0",
"server.socket_port": 9095,
},
'/': {
'tools.recaptcha.on': True,
'tools.recaptcha.remoteip': '',
# For production level, uncomment this lines
# 'tools.recaptcha.secret_key': 'MY_SECRET_KEY',
# 'tools.recaptcha.site_key': 'MY_SITE_KEY',
}
}
cherrypy.quickstart(Root(), '/', config)
Metadata
Release files for marbaloo_recaptcha 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| marbaloo_recaptcha-0.1.0.tar.gz | 3.8 kB | Without provenance | Details for marbaloo_recaptcha-0.1.0.tar.gz |
Release files / marbaloo_recaptcha-0.1.0.tar.gz
| Download URL | marbaloo_recaptcha-0.1.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d5e6994484c5d11a9708ebc09c377f5fa62db2027c695412bf369426b2e2c84
|
|
BLAKE2b-256 checksum How to use checksums |
6177a7ccbdd5dbfb2c1204e54c6f3ec9d1aa4b84a5cb55d7c60cf2adb1ae9206
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for marbaloo_recaptcha 0.1.0
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.