31 lines
1.4 KiB
Python
31 lines
1.4 KiB
Python
import json
|
|||
|
|
|
||
|
|
with open("scratch/unified_docs_data.json") as f:
|
||
|
|
data = json.load(f)
|
||
|
|
|
||
|
|
for s in data["sections"]:
|
||
|
|
for a in s["apis"]:
|
||
|
|
base_link = a["api_ip_link"].rstrip("/")
|
||
|
|
for ep in a["endpoints"]:
|
||
|
|
# Specific fixes
|
||
|
|
if a["api_key"] == "Stable_Diffusion_Caricature_Effects":
|
||
|
|
ep["full_url"] = "https://apigp0006.creinnovations.in/apis/mlm/stable_diffusion_caricature_effects/image/"
|
||
|
|
elif a["api_key"] == "Stable_Diffusion_Hair_Color_Changer_And_Hair_Style_Changer":
|
||
|
|
if "style" in ep["subpath"]:
|
||
|
|
ep["full_url"] = "https://apigp0006.creinnovations.in/apis/flxf/flux_fill/hair_style_changer/image/"
|
||
|
|
else:
|
||
|
|
ep["full_url"] = "https://apigp0006.creinnovations.in/apis/flxf/flux_fill/hair_color_changer/image/"
|
||
|
|
elif a["api_key"] == "Credits_Limit":
|
||
|
|
if "admin" in ep["subpath"]:
|
||
|
|
ep["full_url"] = "https://apigp0006.creinnovations.in/apis/flxk/credits/admin/api/accounts"
|
||
|
|
else:
|
||
|
|
ep["full_url"] = "https://apigp0006.creinnovations.in/apis/flxk/credits/use"
|
||
|
|
else:
|
||
|
|
# remove any double /image/image/
|
||
|
|
ep["full_url"] = ep["full_url"].replace("/image/image/", "/image/")
|
||
|
|
|
||
|
|
with open("scratch/unified_docs_data.json", "w") as f:
|
||
|
|
json.dump(data, f, indent=2)
|
||
|
|
|
||
|
|
print("Exact URL fixes applied!")
|