Skip to main content

CORS handling as a cherrypy tool.

Project description

https://img.shields.io/pypi/v/cherrypy-cors.svg https://img.shields.io/pypi/pyversions/cherrypy-cors.svg tests Ruff Code style: Black https://readthedocs.org/projects/cherrypy-cors/badge/?version=latest https://img.shields.io/badge/skeleton-2023-informational

CORS support for CherryPy

In a nutshell

In your application, either install the tool globally.

import cherrypy_cors
cherrypy_cors.install()

Or add it to your application explicitly.

import cherrypy_cors
app = cherrypy.tree.mount(...)
app.toolboxes['cors'] = cherrypy_cors.tools

Then, enable it in your cherrypy config. For example, to enable it for all static resources.

config = {
    '/static': {
        'tools.staticdir.on': True,
        'cors.expose.on': True,
    }
}

See simple-example for a runnable example.

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

cherrypy-cors-1.7.0.tar.gz (10.3 kB view hashes)

Uploaded Source

Built Distribution

cherrypy_cors-1.7.0-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

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