File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 77
88
99def send_email (recipient , subject , body ):
10- # Magic to send an email
10+ # 模拟邮件发送动作
11+ print ('send mail.' )
1112 return True
1213
1314
15+ def callback (future ):
16+ print ('callback' )
17+
18+
1419@app .route ('/signup' )
1520def signup ():
16- # Do signup form
17- executor .submit (send_email , recipient , subject , body )
21+ executor .add_default_done_callback (callback )
22+ executor .submit (send_email , "test@gmail.com" , "subject" , "body" )
23+ return "signup done."
24+
25+
26+ if __name__ == '__main__' :
27+ app .run ('0.0.0.0' , debug = True , port = 5000 )
Original file line number Diff line number Diff line change 242422 . [ 在浏览器中播放rtsp实时流] ( https://xugaoxiang.com/2020/11/12/flask-22-opencv-rtsp/ )
252523 . [ 简单异步任务] ( https://xugaoxiang.com/2020/11/16/flask-23-threadpoolexecutor/ )
262624 . [ http请求转发] ( https://xugaoxiang.com/2020/11/24/flask-24-http-proxy/ )
27- 25 . [ 接收多文件] ( https://xugaoxiang.com/2021/05/20/flask-25-receive-multiple-files/ )
27+ 25 . [ 接收多文件] ( https://xugaoxiang.com/2021/05/20/flask-25-receive-multiple-files/ )
28+ 25 . [ flask-executor] ( https://xugaoxiang.com/2021/12/27/flask-26-flask-executor/ )
You can’t perform that action at this time.
0 commit comments