import json import re from urllib.parse import urlparse with open("/home/creserver/Desktop/Vaishno_workspace/Jsons/credentials_23-10-2026.json") as f: creds = json.load(f) with open("web/docs/index.html") as f: html = f.read() m = re.search(r'', html, re.DOTALL) data = json.loads(m.group(1)) all_eps = [ep for s in data["sections"] for ep in s["eps"]] print(f"Total Creds: {len(creds['data'])}") print(f"Total Current Doc Endpoints: {len(all_eps)}") # Let's map each credential entry to its matching endpoint(s) # Each cred has: api_key, api_ip_link # Example: # api_key: "Teeth_Whitener", api_ip_link: "https://apigp0006.creinnovations.in/apis/mlm/teeth_whitener/" # Endpoints in docs: # /teeth_whitener/image/ # /teeth_whitener/image_full/ results = [] matched_ep_ids = set() for c in creds["data"]: key = c["api_key"] link = c["api_ip_link"] # Extract path portion from link parsed = urlparse(link) base_url = f"{parsed.scheme}://{parsed.netloc}" api_path = parsed.path # e.g. /apis/mlm/teeth_whitener/ # Identify key path identifier, e.g. "teeth_whitener", "new_enhancer", "flux_fill/hair_color_changer" # Notice that link can be: # https://apigp0006.creinnovations.in/apis/flxf/flux_fill/hair_color_changer/ # https://apigp0905.creinnovations.in/apis/lxds/sdxl/text_to_image/ # https://apigp0006.creinnovations.in/apis/flxk/flux/headshots/ # Strip /apis/mlm/, /apis/lxds/, /apis/flxf/, /apis/flxk/, /apis/cmf/ rel_path = re.sub(r"^/apis/(mlm|lxds|flxf|flxk|cmf)/", "/", api_path) rel_path_clean = rel_path.strip("/") matches = [] for ep in all_eps: ep_p = ep["path"].strip("/") # Check direct prefix or substring if rel_path_clean in ep_p or ep_p.startswith(rel_path_clean) or (rel_path_clean.split("/")[-1] in ep_p.split("/")): matches.append(ep) matched_ep_ids.add(ep["id"]) results.append({ "api_key": key, "api_ip_link": link, "base_url": base_url, "api_path": api_path, "rel_path": rel_path, "matches": matches }) print("\n--- Summary of matches ---") with_matches = [r for r in results if r["matches"]] no_matches = [r for r in results if not r["matches"]] print(f"Matched APIs: {len(with_matches)} / {len(results)}") print(f"Unmatched APIs: {len(no_matches)}") if no_matches: print("Unmatched:") for nm in no_matches: print(f" - {nm['api_key']}: {nm['api_ip_link']}") unmatched_eps = [ep for ep in all_eps if ep["id"] not in matched_ep_ids] print(f"\nEndpoints in doc not matched to any cred ({len(unmatched_eps)}):") for uep in unmatched_eps: print(f" - {uep['path']} ({uep['title']})")