Skip to main content

A Flask extension adding a decorator for CORS support

Project description

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!"

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 me or send me an email.

Bitdeli Badge

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

Flask-Cors-1.1.2.tar.gz (8.8 kB view details)

Uploaded Source

File details

Details for the file Flask-Cors-1.1.2.tar.gz.

File metadata

  • Download URL: Flask-Cors-1.1.2.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Flask-Cors-1.1.2.tar.gz
Algorithm Hash digest
SHA256 b87a3fa9d32f2c4352dd3442924e0724d98f4f23e9c574c3f6020915e145420d
MD5 45be6c1ab8ca0a68d7b437ee0bb650f4
BLAKE2b-256 87247344c16001e294f17a7bffe83c9cdacbb53241a56df05ca0a276d6648911

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page