Skip to main content

Flask-CORS

Flask-CORS is a simple extension to Flask allowing you to support cross origin resource sharing (CORS) using a simple decorator.

Build Status

Installation

Install the extension with using pip, or easy_install.

$ pip install flask-cors

Usage

This extension exposes a simple decorator to decorate flask routes with. Simply add @cross_origin() below a call to Flask’s @app.route(..) incanation to accept the default options and allow CORS on a given route.

Simple Usage

@app.route("/")
@cross_origin() # allow all origins all methods.
def helloWorld():
  return "Hello, cross-origin-world!"

Using defaults

Alternatively, setting your application’s CORS_ORIGINS configuration property will

app.config['CORS_ORIGINS'] = ['Foo', 'Bar']
@app.route("/")
@cross_origin() # will return CORS headers for origins 'Foo' and 'Bar'
def helloWorld():
  return "Hello, cross-origin-world!"

For a full list of options, please see the full documentation

Tests

A simple set of tests is included in test.py. To run, install nose, and simply invoke nosetests or run python test.py to exercise the tests.

Contributing

Questions, comments or improvements? Please create an issue on Github, tweet at [@wcdolphin](https://twitter.com/wcdolphin) or send me an email.

Bitdeli Badge

Metadata

Release files for flask-cors 1.3.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 flask-cors 1.3.0
File Size Uploaded Provenance
Flask-Cors-1.3.0.tar.gz 9.6 kB Without provenance Details

Release files / Flask-Cors-1.3.0.tar.gz

Download URL Flask-Cors-1.3.0.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c6d4f1166ae7e63a66e77b95498db131575f814cce6f36e913174e97596410a5
BLAKE2b-256 checksum
How to use checksums
f60f56e68c4066ac08bbff6bd69ba620d31442f05e0f4bb74c0561ff3528dfce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for flask-cors 1.3.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.

Release history Release notifications | RSS feed

This release

1.3.0 This release

1 release file No provenance

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