MediaRouter / _audit /audit_routes.py
basyx's picture
Upload 692 files
4d9c047 verified
Raw
History Blame Contribute Delete
866 Bytes
import ast, os, re
from pathlib import Path
root=Path('.')
for path in ['app/api','app/brand','app/projects','app/social','app/ai','app/analytics','app/templates','app/copilot']:
p=root/path
if not p.exists(): continue
for py in p.rglob('*.py'):
try:
txt=py.read_text()
except Exception:
continue
if 'APIRouter(' in txt or '@router.' in txt:
hits=[]; pos=0
while True:
m=re.search(r'@router\.(get|post|patch|put|delete|options|head)\(([^\n]+)\)', txt[pos:])
if not m: break
hits.append((pos+m.start()+1, m.group(1), m.group(2).strip()))
pos += m.end()
if hits:
print('\n###', py)
for line, method, expr in hits:
print(f'{line}: {method.upper()} {expr}')