mirror of
https://github.com/revanced/revanced-api.git
synced 2025-05-03 08:04:27 +02:00
17 lines
509 B
Python
17 lines
509 B
Python
# api/__init__.py
|
|
from sanic import Blueprint
|
|
import importlib
|
|
import pkgutil
|
|
|
|
blueprints = []
|
|
for _, module_name, _ in pkgutil.iter_modules(["api"]):
|
|
# Import the module
|
|
module = importlib.import_module(f"api.{module_name}")
|
|
|
|
# Add the module's blueprint to the list, if it exists
|
|
if hasattr(module, module_name):
|
|
blueprints.append(getattr(module, module_name))
|
|
|
|
# Create the Blueprint group with the dynamically imported blueprints
|
|
api = Blueprint.group(*blueprints, url_prefix="/")
|