1import json
 2
 3with open('json/proxies.json') as f:
 4    x = json.load(f)
 5
 6text = ""
 7for i in x["cards"]:
 8    text += f"""
 9    <div class="card">
10        <h1>{i["name"]}</h1>
11        <p>{i["description"]}</p>
12        <a href="{i["link"]}"><button class="button">{i["button_text"]}</button></a>
13    """
14    if i["tor"] != "#":
15        text += f'<a href="{i["tor"]}"><button class="tor">Tor</button></a>'
16
17    text += "</div>"
18
19with open('_site/proxies/index.html') as f:
20    y = f.read()
21
22y = y.replace('<!-- Static cards -->', text)
23with open('_site/proxies/index.html', 'w') as f:
24    f.write(y)