OpenQuizz
Une application de gestion des contenus pédagogiques
flask_cors.core Namespace Reference

Functions

def parse_resources (resources)
 
def get_regexp_pattern (regexp)
 
def get_cors_origins (options, request_origin)
 
def get_allow_headers (options, acl_request_headers)
 
def get_cors_headers (options, request_headers, request_method)
 
def set_cors_headers (resp, options)
 
def probably_regex (maybe_regex)
 
def re_fix (reg)
 
def try_match_any (inst, patterns)
 
def try_match (request_origin, maybe_regex)
 
def get_cors_options (appInstance, *dicts)
 
def get_app_kwarg_dict (appInstance=None)
 
def flexible_str (obj)
 
def serialize_option (options_dict, key, upper=False)
 
def ensure_iterable (inst)
 
def sanitize_regex_param (param)
 
def serialize_options (opts)
 

Variables

 LOG
 
 ACL_ORIGIN
 
 ACL_METHODS
 
 ACL_ALLOW_HEADERS
 
 ACL_EXPOSE_HEADERS
 
 ACL_CREDENTIALS
 
 ACL_MAX_AGE
 
 ACL_REQUEST_METHOD
 
 ACL_REQUEST_HEADERS
 
 ALL_METHODS
 
 CONFIG_OPTIONS
 
 FLASK_CORS_EVALUATED
 
 RegexObject
 
 DEFAULT_OPTIONS
 
 origins
 
 methods = ALL_METHODS,
 
string allow_headers = '*',
 
 expose_headers = None,
 
bool supports_credentials = False,
 
 max_age = None,
 
bool send_wildcard = False,
 
bool automatic_options = True,
 
bool vary_header = True,
 
string resources = r'/*',
 
bool intercept_exceptions = True,
 
bool always_send = True)
 

Function Documentation

◆ ensure_iterable()

def flask_cors.core.ensure_iterable (   inst)
Wraps scalars or string types as a list, or returns the iterable instance.

◆ flexible_str()

def flask_cors.core.flexible_str (   obj)
A more flexible str function which intelligently handles stringifying
strings, lists and other iterables. The results are lexographically sorted
to ensure generated responses are consistent when iterables such as Set
are used.

◆ get_allow_headers()

def flask_cors.core.get_allow_headers (   options,
  acl_request_headers 
)

◆ get_app_kwarg_dict()

def flask_cors.core.get_app_kwarg_dict (   appInstance = None)
Returns the dictionary of CORS specific app configurations.

◆ get_cors_headers()

def flask_cors.core.get_cors_headers (   options,
  request_headers,
  request_method 
)

◆ get_cors_options()

def flask_cors.core.get_cors_options (   appInstance,
dicts 
)
Compute CORS options for an application by combining the DEFAULT_OPTIONS,
the app's configuration-specified options and any dictionaries passed. The
last specified option wins.

◆ get_cors_origins()

def flask_cors.core.get_cors_origins (   options,
  request_origin 
)

◆ get_regexp_pattern()

def flask_cors.core.get_regexp_pattern (   regexp)
Helper that returns regexp pattern from given value.

:param regexp: regular expression to stringify
:type regexp: _sre.SRE_Pattern or str
:returns: string representation of given regexp pattern
:rtype: str

◆ parse_resources()

def flask_cors.core.parse_resources (   resources)

◆ probably_regex()

def flask_cors.core.probably_regex (   maybe_regex)

◆ re_fix()

def flask_cors.core.re_fix (   reg)
    Replace the invalid regex r'*' with the valid, wildcard regex r'/.*' to
    enable the CORS app extension to have a more user friendly api.

◆ sanitize_regex_param()

def flask_cors.core.sanitize_regex_param (   param)

◆ serialize_option()

def flask_cors.core.serialize_option (   options_dict,
  key,
  upper = False 
)

◆ serialize_options()

def flask_cors.core.serialize_options (   opts)
A helper method to serialize and processes the options dictionary.

◆ set_cors_headers()

def flask_cors.core.set_cors_headers (   resp,
  options 
)
Performs the actual evaluation of Flas-CORS options and actually
modifies the response object.

This function is used both in the decorator and the after_request
callback

◆ try_match()

def flask_cors.core.try_match (   request_origin,
  maybe_regex 
)
Safely attempts to match a pattern or string to a request origin.

◆ try_match_any()

def flask_cors.core.try_match_any (   inst,
  patterns 
)

Variable Documentation

◆ ACL_ALLOW_HEADERS

ACL_ALLOW_HEADERS

◆ ACL_CREDENTIALS

ACL_CREDENTIALS

◆ ACL_EXPOSE_HEADERS

ACL_EXPOSE_HEADERS

◆ ACL_MAX_AGE

ACL_MAX_AGE

◆ ACL_METHODS

ACL_METHODS

◆ ACL_ORIGIN

ACL_ORIGIN

◆ ACL_REQUEST_HEADERS

ACL_REQUEST_HEADERS

◆ ACL_REQUEST_METHOD

ACL_REQUEST_METHOD

◆ ALL_METHODS

ALL_METHODS

◆ allow_headers

string allow_headers = '*',

◆ always_send

bool always_send = True)

◆ automatic_options

bool automatic_options = True,

◆ CONFIG_OPTIONS

CONFIG_OPTIONS

◆ DEFAULT_OPTIONS

DEFAULT_OPTIONS

◆ expose_headers

expose_headers = None,

◆ FLASK_CORS_EVALUATED

FLASK_CORS_EVALUATED

◆ intercept_exceptions

bool intercept_exceptions = True,

◆ LOG

LOG

◆ max_age

max_age = None,

◆ methods

methods = ALL_METHODS,

◆ origins

origins

◆ RegexObject

RegexObject

◆ resources

string resources = r'/*',

◆ send_wildcard

bool send_wildcard = False,

◆ supports_credentials

bool supports_credentials = False,

◆ vary_header

bool vary_header = True,