~wrycode/plr

ref: 47d52497b345133a802290ef1c27eae4aa0a2547 plr/app.py -rw-r--r-- 588 bytes View raw
47d52497Zack Scholl Fixed up the site, added to READMEy 4 years 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)