openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 3072
开启用户密码验证
@auth.verify_password
def verify_password(username, password):
if username == 'abcdefg' and password == '1234546':
return username
@app.route('/post_request', methods=['POST'])
@auth.login_required
def my_method():
# my code here
resp_obj = {'info':'hello'}
return jsonify(resp_obj);
if __name__ == '__main__':
app.run(host='0.0.0.0', port=60000)
开启https,使用第一步中生成的2个文件,配置flask服务器。