By implementing the interface ratelimit access to the flask restrictions

from ratelimit import limits
import pymysql
import json
import flask
 
 
app = Flask(__name__)
app.config['JSON_AS_ASCII'] = False
@app.route('/getdate')
@limits(calls = 1,period = 2)
def hello():
  return jsonify({'code':'200'})
 
 
 
The interface limit per 2s can only be accessed once

Guess you like

Origin www.cnblogs.com/zhujunsheng/p/11127587.html