fc

falcon-cors

CORS support for Falcon: http://falconframework.org

Showing:

Popularity

Downloads/wk

0

GitHub Stars

76

Maintenance

Last Commit

1yr ago

Contributors

3

Package

Dependencies

0

License

Categories

Readme

.. image:: https://travis-ci.org/lwcolton/falcon-cors.svg?branch=master :target: https://travis-ci.org/lwcolton/falcon-cors

falcon-cors

About

This is a CORS algorithm and a falcon middleware for CORS.

Interface Documentation: https://falcon-cors.readthedocs.org/en/master/falcon_cors.html

pypi: https://pypi.python.org/pypi/falcon-cors

Install

.. code-block:: shell

pip install falcon-cors

Usage

.. code-block:: python

import falcon
from falcon_cors import CORS

cors = CORS(allow_origins_list=['http://test.com:8080'])

api = falcon.API(middleware=[cors.middleware])

Override CORS for a specific resource

.. code-block:: python

import falcon
from falcon_cors import CORS

cors = CORS(allow_origins_list=['http://test.com:8080'])

api = falcon.API(middleware=[cors.middleware])

public_cors = CORS(allow_all_origins=True)

class MyPublicResource:
    cors = public_cors

    def on_post(self, req, resp):
        resp.body = "Everone can post to this resource"

api.add_route("/public", MyPublicResource())

Turn CORS off for a specific resource

.. code-block:: python

class MyResource:
    cors_enabled = False

Tests and Contributing

If you want to contribute just submit a PR and please make sure you have created some tests for your feature.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial