Skip to main content

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


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 details)

Uploaded Source

Built Distribution

yafcorse-1.0.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file yafcorse-1.0.0.tar.gz.

File metadata

  • Download URL: yafcorse-1.0.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for yafcorse-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f030e3ee736e8bc58463d39fb80216432f41a18b608a904c8fda16cdeb46d849
MD5 ffa03db0374ca83b7f6b75083f9220ef
BLAKE2b-256 50a7b0b739c72ca2f343cb9d1a7e40cc2b95c33448f256161c3955d430a86991

See more details on using hashes here.

File details

Details for the file yafcorse-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: yafcorse-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for yafcorse-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2da0a5c36202f770233bf86453d5ed40f46db02eb525b2ea5db4f9b6b20474aa
MD5 372a1eee6cedc7a82e9361d6d3c21032
BLAKE2b-256 e19f5a75af09167072e2552cc5922696abb6ea45f7e619d05da036574f2bb1a7

See more details on using hashes here.

Supported by

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