Skip to main content

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

Metadata

Release files for yafcorse 1.0.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 yafcorse 1.0.0
File Size Uploaded
yafcorse-1.0.0.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yafcorse 1.0.0
File Interpreter ABI Platform
yafcorse-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.2 kB

Release files / yafcorse-1.0.0.tar.gz

Download URL yafcorse-1.0.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f030e3ee736e8bc58463d39fb80216432f41a18b608a904c8fda16cdeb46d849
BLAKE2b-256 checksum
How to use checksums
50a7b0b739c72ca2f343cb9d1a7e40cc2b95c33448f256161c3955d430a86991
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.6

Release files / yafcorse-1.0.0-py3-none-any.whl

Download URL yafcorse-1.0.0-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2da0a5c36202f770233bf86453d5ed40f46db02eb525b2ea5db4f9b6b20474aa
BLAKE2b-256 checksum
How to use checksums
e19f5a75af09167072e2552cc5922696abb6ea45f7e619d05da036574f2bb1a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

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