Skip to main content

parse_cors

Parses a value into a list of CORS origin strings or a single string, supporting comma-separated values or existing list structures.

def parse_cors(
v: Any
) - > list[str] | str

Parses a comma-separated string or a list into a format suitable for Cross-Origin Resource Sharing (CORS) configuration. Use this to normalize environment variables or configuration strings into a list of allowed origins.

Parameters

NameTypeDescription
vAnyThe raw input value to be parsed, typically a comma-separated string of origins, a list of strings, or a JSON-formatted string.

Returns

TypeDescription
`list[str]str`