rest api测试工具
dbgr的Python项目详细描述
dbgr[read'_di_b_r']是一个用于测试和调试http api的交互式终端工具。 它提供了Postman、Insomnia和其他http客户端的替代方案。它是设计的 对于喜欢使用代码而不是图形工具并希望完全控制的程序员 通过他们的http请求。
Full documentation can be found on Read the Docs
功能
快速启动
使用dbgr的第一步是创建一个目录,该目录将搜索dbgr 用于请求和环境设置。
You can also download the quickstart from Github.
$ mkdir quickstart
$ cd quickstart
在内部创建默认环境文件default.ini。现在只是地方 内部的节标题:
[default]
现在创建另一个文件,调用它quickstart.py,并放置create your first request:
fromdbgrimportrequest@requestasyncdefget_example(session):awaitsession.get('http://example.com')
您可以通过运行dbgr list:
$ dbgr list quickstart: - get_example
要执行它,请运行dbgr request get_example:
# Output in this example is shortened > GET http://example.com > 200 OK > > Request headers: > Host: example.com > Accept: */* > Accept-Encoding: gzip, deflate > User-Agent: Python/3.6 aiohttp/3.5.4 < < Response headers: < Content-Encoding: gzip < Accept-Ranges: bytes < Cache-Control: max-age=604800 < Content-Type: text/html;charset=UTF-8 < Date: Sun, 16 Jun 201915:29:41 GMT < Last-Modified: Fri, 09 Aug 201323:54:35 GMT < Content-Length: 606 < < Response data (text/html): <!doctype html> <html> <head> <title>Example Domain</title> <meta charset="utf-8" /> <meta http-equiv="Content-type"content="text/html; charset=utf-8" /> <meta name="viewport"content="width=device-width, initial-scale=1" /> </head> <body> <div> <h1>Example Domain</h1> <p>This domain is established to be used for illustrative examples in documents. You may use this domain in examples without prior coordination or asking for permission.</p> <p><a href="http://www.iana.org/domains/example">More information...</a></p> </div> </body> </html> Result (NoneType)