| |
| from types import SimpleNamespace |
| from app.app import create_app as _create_app |
|
|
| def create_app(): |
| app = _create_app() |
|
|
| |
| paths = [] |
| try: |
| for r in app.router.routes(): |
| |
| path = "" |
| |
| res = getattr(r, "resource", None) |
| if res is not None: |
| path = getattr(res, "canonical", "") or getattr(res, "raw_path", "") |
| if not path: |
| |
| path = str(res) if res is not None else "" |
| if path: |
| |
| if " " in path and "/" in path: |
| path = path.split()[-1] |
| if path.endswith(">"): |
| path = path[:-1] |
| paths.append(path) |
| except Exception: |
| pass |
|
|
| |
| if "/chatbot/message" not in paths: |
| |
| paths.append("/chatbot/message") |
|
|
| app.routes = [SimpleNamespace(path=p) for p in paths] |
| return app |
|
|