想请教一下各位大佬,我在服务端(油猴脚本),以及客户端(py脚本)的计时测速都挺快的(均为1s不到),但是实测下来(掐秒表)整个数据获取过程需要接近10s,请问问题是出在哪里?
服务端:https://scriptcat.org/script-show-page/1209
客户端:
from flask_cors import CORS
from flask import Flask, request
from redis import StrictRedis
import logging
import time
app = Flask(name)
redisCli = StrictRedis(
host='127.0.0.1',
port=6379,
db=0
)
@app.route('/airLines', methods=['POST'])
def airLines():
if request.method == 'POST':
time_start = time.time() # 开始计时
form_data = request.get_data()
redisCli.rpush('listPage', form_data) # 推到redis列表页
print(form_data.decode())
time_end = time.time() # 结束计时
time_c = time_end - time_start # 运行所花时间
print('time cost', time_c, 's')
return form_data
if name == 'main':
CORS(app, supports_credentials=True) # 允许跨域
app.run(host='127.0.0.1', port=8883, debug=False)