Dbgr [read 'ˌdiːˈbʌɡər'] is a interactive terminal tool to test and debug HTTP APIs. It offers alternative to Postman, Insomnia and other HTTP clients. It is designed for programmers that prefer to use code instead of graphical tools and want full control over their HTTP requests.
Full documentation can be found on Read the Docs
- Terminal interface with autocomplete and bash history
- Full control over your requests with Python
- Recursive calls
- Local caching of responses
- Customizable interface
The easiest way to install DBGR is via PyPi:
$ pip install dbgr
$ dbgr -v
1.1.0
DBGR requires Python >=3.6.
First step when working with DBGR is to create a directory which will DBGR search for requests and environment settings.
You can also download the quickstart from Github.
$ mkdir quickstart
$ cd quickstart
Inside create your default environment file default.ini
. For now just place
a section header inside:
[default]
Now create another file, call it quickstart.py
and place create your first request:
from dbgr import request
@request
async def get_example(session):
await session.get('http://example.com')
You can check that DBGR registered the request by running dbgr list
:
$ dbgr list
quickstart:
- get_example
To execute it, run 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 2019 15:29:41 GMT
< Last-Modified: Fri, 09 Aug 2013 23: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)