Python has several interactive shells (aka. REPLs) that you can use to explore Python directly and you can also tell python that a certain point in your application it will enter the REPL and allow you to discover things from that point.

ptpython is such a REPL.

pip install ptpython

Then I used the following code:


import requests
from ptpython.repl import embed

res = requests.get("")
embed(globals(), locals())


Debug with PTPython