~wrycode/plr

ref: a5a4457b5aa0e2c081662adc4177af95338fccd4 plr/app.py -rw-r--r-- 590 bytes View raw
a5a4457b — Ellie Mae Galyean Seems to work with python3 now 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from flask import Flask, render_template, request, jsonify

from lib import *

app = Flask(__name__)
app.debug = True

@app.route("/")
def hello():
    return render_template('index.html')

@app.route('/permanize', methods=['POST', 'OPTIONS'])
def my_service():
	request.get_json(force=True)
	print(request.json)
	text = request.json['text']
	if 'apikey' in request.json and len(request.json['apikey'])>0:
		return jsonify(text=replaceText(text,request.json['apikey']))
	else:
		return jsonify(text=replaceText(text,False))

if __name__ == "__main__":
    app.run(host='0.0.0.0',port=8012)