LingoSynth/lingosynth/app/api.py

18 lines
401 B
Python
Raw Normal View History

2023-05-11 21:48:16 +02:00
import time
import flask
def register(app: flask.Flask):
@app.route('/api/rephrase', methods=['GET', 'POST'])
@app.rate_limiter.limit('2 per second')
def api_rephrase():
text = flask.request.args.get('text') or flask.request.json.get('text')
time.sleep(3)
raise
return flask.jsonify(
{
'text': 'Done.'
}
)