Skip to main content

Pyramid Captcha

This Python package provides a captcha implementation for use with the Pyramid Web Framework. It is based on the captcha library and uses Pyramid sessions for captcha validation. Please refer to the documentation for further information.

Usage

To generate a captcha, you have to import the class Captcha.

from pyramid_captcha import Captcha

The simplest solution is to use this class directly in your view definition.

config.add_route('captcha_generate', '/captcha')
config.add_view(
    Captcha,
    attr='generate',
    route_name='captcha_generate',
    request_method='GET'
)

In this case, the route /captcha will return a captcha image with the default length of 6 characters. If you want to adjust the captcha properties, you have to wrap it into a view callable, for example to change the number of characters.

def generate(request):
    return Captcha(request, length=4).generate()

The generated captcha value is stored in the current session. It can be checked against a submitted form value using the validate() method.

try:
    Captcha(request).validate()
except CaptchaError as e:
    raise HTTPForbidden(e)

Demo

You can check out the code and run a little demo by calling make serve.

Changelog

1.0.0

https://gitlab.com/geo-bl-ch/pyramid-captcha/-/milestones/1

  • Add parameter for value validation

  • Configurable captcha length

  • Initial version

Metadata

Release files for pyramid-captcha 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyramid-captcha 1.0.0
File Size Uploaded Provenance
pyramid_captcha-1.0.0.tar.gz 4.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyramid-captcha 1.0.0
File Interpreter ABI Platform
pyramid_captcha-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / pyramid_captcha-1.0.0.tar.gz

Download URL pyramid_captcha-1.0.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bc156b3ce2db1b34a97d60fb96277a5dedb604e51e8685f54de9047117e99678
BLAKE2b-256 checksum
How to use checksums
073bf1c86a3a935836b59abd5094d9526f102e3fe44923b36d3812f0125defc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.6.1 requests/2.25.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

Release files / pyramid_captcha-1.0.0-py3-none-any.whl

Download URL pyramid_captcha-1.0.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9437d9e0e664a8077262ad8d776c35c33174eb033c200f6d8ffe29964b71f8af
BLAKE2b-256 checksum
How to use checksums
b302ec2ca2c9754123df5cb83e3664d5f440b65371bc5cb11b700d58cbecab91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.6.1 requests/2.25.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

Security for pyramid-captcha 1.0.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page