Files
SIB/backend/parse_openapi_v2.py

17 lines
646 B
Python

import json
with open("vertexdc_openapi.json", "r", encoding="utf-16" if "\xFF\xFE" in open("vertexdc_openapi.json", "rb").read(2).decode("latin-1", errors="ignore") else "utf-8") as f:
try:
content = f.read()
# Clean potential BOM or leading spaces
content = content.strip()
data = json.loads(content)
for path in data.get("paths", {}):
if "/api/users" in path:
print(path)
except Exception as e:
print(f"Error parsing JSON: {e}")
# Let's print the first 100 chars to see what's wrong
f.seek(0)
print(f"Start of file: {f.read(100)!r}")