#NEWLINE# def cross_origin( * args , **kwargs ) : #NEWLINE# #INDENT# "\n    This function is the decorator which is used to wrap a Flask route with.\n    In the simplest case, simply use the default parameters to allow all\n    origins in what is the most permissive configuration. If this method\n    modifies state or performs authentication which may be brute-forced, you\n    should add some degree of protection, such as Cross Site Forgery\n    Request protection.\n\n    :param origins:\n        The origin, or list of origins to allow requests from.\n        The origin(s) may be regular expressions, case-sensitive strings,\n        or else an asterisk\n\n        Default : '*'\n    :type origins: list, string or regex\n\n    :param methods:\n        The method or list of methods which the allowed origins are allowed to\n        access for non-simple requests.\n\n        Default : [GET, HEAD, POST, OPTIONS, PUT, PATCH, DELETE]\n    :type methods: list or string\n\n    :param expose_headers:\n        The header or list which are safe to expose to the API of a CORS API\n        specification.\n\n        Default : None\n    :type expose_headers: list or string\n\n    :param allow_headers:\n        The header or list of header field names which can be used when this\n        resource is accessed by allowed origins. The header(s) may be regular\n        expressions, case-sensitive strings, or else an asterisk.\n\n        Default : '*', allow all headers\n    :type allow_headers: list, string or regex\n\n    :param supports_credentials:\n        Allows users to make authenticated requests. If true, injects the\n        `Access-Control-Allow-Credentials` header in responses. This allows\n        cookies and credentials to be submitted across domains.\n\n        :note: This option cannot be used in conjuction with a '*' origin\n\n        Default : False\n    :type supports_credentials: bool\n\n    :param max_age:\n        The maximum time for which this CORS request maybe cached. This value\n        is set as the `Access-Control-Max-Age` header.\n\n        Default : None\n    :type max_age: timedelta, integer, string or None\n\n    :param send_wildcard: If True, and the origins parameter is `*`, a wildcard\n        `Access-Control-Allow-Origin` header is sent, rather than the\n        request's `Origin` header.\n\n        Default : False\n    :type send_wildcard: bool\n\n    :param vary_header:\n        If True, the header Vary: Origin will be returned as per the W3\n        implementation guidelines.\n\n        Setting this header when the `Access-Control-Allow-Origin` is\n        dynamically generated (e.g. when there is more than one allowed\n        origin, and an Origin than '*' is returned) informs CDNs and other\n        caches that the CORS headers are dynamic, and cannot be cached.\n\n        If False, the Vary header will never be injected or altered.\n\n        Default : True\n    :type vary_header: bool\n\n    :param automatic_options:\n        Only applies to the `cross_origin` decorator. If True, Flask-CORS will\n        override Flask's default OPTIONS handling to return CORS headers for\n        OPTIONS requests.\n\n        Default : True\n    :type automatic_options: bool\n\n    " #NEWLINE# _options = kwargs #NEWLINE# def decorator( f ) : #NEWLINE# #INDENT# LOG . debug ( 'Enabling %s for cross_origin using options:%s' , f , _options ) #NEWLINE# if _options . get ( 'automatic_options' , True ) : #NEWLINE# #INDENT# f . required_methods = getattr ( f , 'required_methods' , set ( ) ) #NEWLINE# f . required_methods . add ( 'OPTIONS' ) #NEWLINE# f . provide_automatic_options = False #NEWLINE# #UNINDENT# def wrapped_function( * args , **kwargs ) : #NEWLINE# #INDENT# options = get_cors_options ( current_app , _options ) #NEWLINE# if ( options . get ( 'automatic_options' ) and ( request . method == 'OPTIONS' ) ) : #NEWLINE# #INDENT# resp = current_app . make_default_options_response ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# resp = make_response ( f ( * args , ** kwargs ) ) #NEWLINE# #UNINDENT# set_cors_headers ( resp , options ) #NEWLINE# setattr ( resp , FLASK_CORS_EVALUATED , True ) #NEWLINE# return resp #NEWLINE# #UNINDENT# return update_wrapper ( wrapped_function , f ) #NEWLINE# #UNINDENT# return _options