9
0
mirror of https://github.com/donlon/cloudflare-error-page.git synced 2025-12-19 23:09:29 +00:00

python: support type hinting for input params

This commit is contained in:
Anthony Donlon
2025-12-16 22:48:32 +08:00
parent ed711a2521
commit 58bf0d6b79
4 changed files with 71 additions and 9 deletions

View File

@@ -11,6 +11,7 @@ from flask import (
redirect,
)
from cloudflare_error_page import ErrorPageParams
from cloudflare_error_page import render as render_cf_error_page
from .utils import fill_cf_template_params
@@ -22,7 +23,7 @@ bp = Blueprint('examples', __name__, url_prefix='/')
param_cache: dict[str, dict] = {}
def get_page_params(name: str) -> dict:
def get_page_params(name: str) -> ErrorPageParams:
name = re.sub(r'[^\w]', '', name)
params = param_cache.get(name)
if params is not None: