Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a4c501a

Browse files
MarkKoz64json
authored andcommitted
Remove spaces from JSON separators for compactness
1 parent e8132e3 commit a4c501a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

algorithm_visualizer/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@
1616

1717
@atexit.register
1818
def execute():
19+
commands = json.dumps(Commander.commands, separators=(",", ":"))
1920
if os.getenv("ALGORITHM_VISUALIZER"):
2021
with open("visualization.json", "w", encoding="UTF-8") as file:
21-
json.dump(Commander.commands, file)
22+
file.write(commands)
2223
else:
2324
import requests
2425
import webbrowser
2526

2627
response = requests.post(
2728
"https://algorithm-visualizer.org/api/visualizations",
28-
json=Commander.commands
29+
headers={"Content-type": "application/json"},
30+
data=commands
2931
)
3032

3133
if response.status_code == 200:

0 commit comments

Comments
 (0)