Yet Another Flask CORS Extension.
Project description
Yet Another Flask CORS Extension
pip install yafcorse
from flask import Flask
from yafcorse import Yafcorse
def create_app():
app = Flask(__name__)
cors = Yafcorse({
'origins': lambda origin: origin == 'https://api.your-domain.space',
'allowed_methods': ['GET', 'POST', 'PUT'],
'allowed_headers': ['Content-Type', 'X-Test-Header'],
'allow_credentials': True,
'cache_max_age': str(60 * 5)
})
cors.init_app(app)
return app
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yafcorse-1.0.0.tar.gz
(3.5 kB
view hashes)