Skip to content

Commit 9cd8849

Browse files
committed
apply indenation to json stored data
1 parent 152b212 commit 9cd8849

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/installation.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@
4141
os.makedirs(INSTALL_PATH)
4242

4343
with open(CONFIG_FILE, "w") as f:
44-
json.dump(config, f)
44+
json.dump(config, f, indent=4)
4545

4646
result = session.get(HOMEPAGE_LINK)
4747
soup = BeautifulSoup(result.text, "html.parser")
48-
4948
for x in soup.find_all("div", "column c1"):
5049
sub_name_url[x.contents[0].get("href")] = ((x.contents[0].contents[1]).split("/")[0]).split("\\")[0]
5150
URLS[x.contents[0].get("href")] = {
@@ -54,9 +53,9 @@
5453
"news":[]
5554
}
5655

57-
json.dump(URLS, open(DATA_FILE, 'w'))
58-
json.dump(sub_name_url, open(SUBJECTS_FILE, "w"))
59-
56+
json.dump(URLS, open(DATA_FILE, 'w'), indent=4)
57+
json.dump(sub_name_url, open(SUBJECTS_FILE, "w"), indent=4)
58+
print("\nInstallation Successful ✔")
6059

6160
except KeyboardInterrupt:
6261
quit("Installation cancelled by user. Please retry.")

src/nalanda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ if __name__ == "__main__":
110110
print ("\t" + bold(SUB_NAMES[x]) + " has new updates")
111111
print ("\tfile://" + SLIDES_PATH)
112112

113-
json.dump(URLS ,open(DATA_FILE, 'w'))
113+
json.dump(URLS ,open(DATA_FILE, 'w'), indent=4)
114114

115115
except requests.exceptions.ConnectionError:
116116
quit("No Internet Connection. Please retry")

0 commit comments

Comments
 (0)