aiohttp可调试
aiohttp_debugtoolbar的Python项目详细描述
aiohttp_debug toolbar为您的aiohttp提供调试工具栏 Web应用程序。库是pyramid_debugtoolbar和 仍处于早期发展阶段。基本功能已经 端口:
- 基本面板
- 拦截重定向
- 截取和漂亮打印异常
- 交互式python控制台
- 显示源代码
端口面板
HeaderDebugPanel,PerformanceDebugPanel,TracebackPanel, SettingsDebugPanel,MiddlewaresDebugPanel,VersionDebugPanel, RoutesDebugPanel,RequestVarsDebugPanel,LoggingPanel
需要帮助
你是不是在找一个项目来做贡献? python/asyncio库?这是你的计划!
安装和配置
$ pip install aiohttp_debugtoolbar
要插入aiohttp_debugtoolbar,请调用 aiohttp_debugtoolbar.setup在你的应用上。
importaiohttp_debugtoolbarapp=web.Application(loop=loop)aiohttp_debugtoolbar.setup(app)
完整示例
importasyncioimportjinja2importaiohttp_debugtoolbarimportaiohttp_jinja2fromaiohttpimportweb@aiohttp_jinja2.template('index.html')asyncdefbasic_handler(request):return{'title':'example aiohttp_debugtoolbar!','text':'Hello aiohttp_debugtoolbar!','app':request.app}asyncdefexception_handler(request):raiseNotImplementedErrorasyncdefinit(loop):# add aiohttp_debugtoolbar middleware to you applicationapp=web.Application(loop=loop)# install aiohttp_debugtoolbaraiohttp_debugtoolbar.setup(app)template=""" <html> <head> <title>{{ title }}</title> </head> <body> <h1>{{ text }}</h1> <p> <a href="{{ app.router['exc_example'].url() }}"> Exception example</a> </p> </body> </html> """# install jinja2 templatesloader=jinja2.DictLoader({'index.html':template})aiohttp_jinja2.setup(app,loader=loader)# init routes for index page, and page with errorapp.router.add_route('GET','/',basic_handler,name='index')app.router.add_route('GET','/exc',exception_handler,name='exc_example')returnapploop=asyncio.get_event_loop()app=loop.run_until_complete(init(loop))web.run_app(app,host='127.0.0.1',port=9000)
更改
0.5.0(2018-02-14)
- 添加安全过滤器以呈现内容195
- 采用AIOHTP3.0
0.4.1(2017-08-30)
- 修复了没有位置标题174的重定向问题
0.4.0(2017-05-04)
- 添加了异步循环分类器
- 添加对aiohttp>;=2.0.7的支持
0.3.0(2016-11-18)
- 修复了使用子应用程序时的中间件路由查找65
- 添加额外面板的示例:pgsql&redis monitor 59
0.2.0(2016-11-08)
- 重构测试套件
0.1.4(2016-11-07)
- 重命名为aiohttp debugtoolbar
- 修复与aiohttp==1.1的不兼容性
0.1.3(2016-10-27)
- 修复“请求信息”页的链接,按字母顺序对请求信息进行排序52
0.1.2(2016-09-27)
- 修复了性能面板43中的空函数名(感谢@kammala!)
- 修复了页面呈现期间的闪烁消息问题46
0.1.1(2016-02-21)
- 修正了演示
- 在“回溯”视图中添加语法突出显示,从 highlight.js到prism.js 31
0.1.0(2016-02-13)
- 修复了python 3.5支持(感谢@stormandco!)
- 在routesdebugpanel中添加了视图源按钮(感谢@stormandco!)
- 放弃了对Python3.3的支持(感谢@sloria!)
- 在setup方法中添加中间件(感谢@sloria!)
- 使用交互式控制台修复了错误
- aiohttp>;的固定支架=0.21.1
0.0.5(2015-09-13)
- 修复了IPv6套接字系列错误(感谢@stormandco!)
0.0.4(2015-09-05)
- aiohttp>;的固定支架=0.17。(谢谢@himikof!)
0.0.3(2015-07-03)
- 将模板引擎从mako切换到jinja2。(谢谢@iho!)
- 添加了自定义的yield from来跟踪协同程序内的上下文切换。
- 已实现用于收集请求日志消息的面板。
- 禁用非Web的工具栏代码注入。响应答案 (例如streamresponse或websocketresponse)12
0.0.2(2015-05-26)
- 重新设计用户界面外观
- 将工具栏中间件工厂重命名为中间件。
0.0.1(2015-05-18)
- 初次发布。