-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.py
More file actions
34 lines (26 loc) · 809 Bytes
/
Copy pathview.py
File metadata and controls
34 lines (26 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from flask import Flask, request, send_from_directory
import json
import os
import requests
LORIPSUM_API_URL = "http://loripsum.net/api/1/short/plaintext"
app = Flask(__name__)
root = os.path.join("my_app")
@app.route('/<path:path>', methods=['GET'])
def static_proxy(path):
return send_from_directory(root, path)
@app.route('/', methods=['GET'])
def redirect_to_index():
return send_from_directory(root, 'index.html')
@app.route("/loripsum", methods=["GET"])
def getlor_job():
r = requests.get(LORIPSUM_API_URL)
return r.text
@app.route("/stat", methods=["POST"])
def strange_job():
# get url
data = json.loads(request.data)
url = data["url"]
res = [l+"W" for l in url]
return json.dumps(res)
if __name__ == "__main__":
app.run(host="localhost", debug = True)