TechDev commited on
Commit
f5136c1
·
verified ·
1 Parent(s): 90d659b

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +19 -0
main.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, request, send_file
2
+ import os, json
3
+
4
+ app = Flask(__name__)
5
+
6
+ @app.route("/")
7
+ def home():
8
+ return '''true'''
9
+ @app.route("/get_states")
10
+ def get():
11
+ states = os.listdir("states")
12
+ states_parse = []
13
+ for s in states:
14
+ states_parse.append({"id":s, "text":open(f"states/{s}/text", "r").read()})
15
+ return json.dumps(states_parse)
16
+ @app.route("/states/<ide>/image.png")
17
+ def get_image(ide):
18
+ return send_file(f"states/{ide}/image.png")
19
+ app.run()