Recursive Calls

Sometimes you might need to make a different request before executing what you really want to do. For example, to download user data, you need to login first. You can do that by using coroutine dbgr.response().


DBGR doesn’t detect or prevent recursion. Be careful not to unintentionally cause DDoS on your (or someone else’s) servers.

Response accepts one required argument - the name of the request to execute as string:

dbgr.response(request_name, env=None, session=None, use_defaults=False, cache=True, silent=False, \*\*kwargs)

Coroutine to make recursive requests.

All kwargs will be mapped to arguments required by target request. Kwargs that are not required by target request will be ignored.

  • request_name (str) – Name of fully qualified name of a request to execute

  • environment (configparser.ConfigParser) – Instance of configparser.ConfigParser with loaded environment variables. Pass this argument only if you want to call request with environment different from current one. (optional)

  • session (aiohttp.ClientSession) – Instance of aiohttp.ClientSession that will be used to make requests. Leave the argument empty, if you want to use current session. (optional)

  • use_defaults (bool) – Boolean flag if DBGR should use default argument value wherever possible. It’s equivalent for to using --use-defaults in terminal. More about it in Arguments section. (optional)

  • cache (bool) – Boolean flag if DBGR should use return value from cache, if available. Applicable only to requests with cache turned on. More about it in Cache section. (optional)

  • silent (bool) – If set to True recursive call (and all other recursive call in the tree bellow) will not print any output. (optional)

from dbgr import request, response, secret

async def login(session, username, password:secret) -> secret:
    res = await'', data={
        'username': username,
        'password': password
    data = await res.json()
    return data['jwt']

async def get_profile(session):
    jwt = await response('login')
    res = await session.get('', headers={
        'Authorization': f'Bearer {jwt}'
$ dbgr r get_profile
password [type: secret]:
< 200 OK
Result (string):

> 200 OK


You can call requests with fully qualified name in the same way you do when calling requests from terminal.