Skip to content

Commit 271b030

Browse files
committed
feat: add static api support
1 parent fbe12cc commit 271b030

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
dist
2+
temp*
13
test*

generateFiles.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import json
2+
import os
3+
4+
5+
def generate_files(json_path, output_dir):
6+
with open(json_path, "r", encoding="utf-8") as json_file:
7+
data = json.load(json_file)
8+
for code, value in data.items():
9+
file_path = os.path.join(output_dir, code)
10+
os.makedirs(output_dir, exist_ok=True)
11+
with open(file_path, "w", encoding="utf-8") as f:
12+
f.write(value)
13+
14+
15+
generate_files("cloudflare-iata.json", os.path.join("dist", "en"))
16+
generate_files("cloudflare-iata-zh.json", os.path.join("dist", "zh"))

0 commit comments

Comments
 (0)