Package: httpdbg
httpdbghttpdbgis a tool for Python developers to easily debug the HTTP(S) client requests in a Python program.To use it, execute your program using thepyhttpdbgcommand instead ofpythonand that's it. Open a browser tohttp://localhost:4909to view the requests:Full documentation =>https://httpdbg.readthedocs.io/installationpip install httpdbgusageinteractive consoleOpen an interactive console using the commandpyhttpdbg.(venv)dev@host:~/dir$pyhttpdbg.... - - .--. -.. -... --. .... - - .--. -.. -... --. .... - - .--. -.. -... --.httpdbg - HTTP(S) requests available at http://localhost:4909/.... - - .--. -.. -... --. .... - - .--. -.. -... --. .... - - .--. -.. -... --.Python 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0] on linuxType "help", "copyright", "credits" or "license" for more information.(InteractiveConsole)>>>Perform HTTP requests.You can inspect the HTTP requests directly in your web browser athttp://localhost:4909.scriptYou can trace all the HTTP requests performed by a scriptpyhttpdbg --script filename.py [arg1 --arg2 ...]pytestYou can trace all the HTTP requests performed during your testspyhttpdbg -m pytest [arg1 --arg2 ...]If you use thepytest-xdistplugin to execute your tests in parallel, then you must install thepytest-httpdbgplugin if you want to trace the requests done by the pytest workers.pip install httpdbg[pytest]moduleYou can trace all the HTTP requests performed by a library module run as a script using the-mcommand line argument.For example, you can view which HTTP requests are performed bypipwhen you install a package.pyhttpdbg -m pip install hookdns --upgradeInitiatorsAn initiator is the function/method that is at the origin of the HTTP requests. By default, we already support some packages but you can add your own initiators.To add a new package in the list of initiators, you can use the-icommand line argument:pyhttpdbg -i api_client_pck --script my_script.pyYou can use any package as an initiator, this is not limited to HTTP requests.Already supported packagespackagesstatusrequestssupportedurllib3supportedhttpxsupportedaiohttpsupportedpytestsupportedyour_packageyes, with the arg-i your_packageconfigurationNo configuration is necessary to start but some few settings are available for particular use.command lineusage: pyhttpdbg [-h] [--port PORT] [--version] [--initiator INITIATOR] [--keep-up | --force-quit][--console | --module MODULE | --script SCRIPT]httdbg - a very simple tool to debug HTTP(S) client requestsoptions:-h, --help            show this help message and exit--port PORT, -p PORT  the web interface port--version, -v         print the httpdbg version--initiator INITIATOR, -i INITIATORadd a new initiator (package)--keep-up, -k         keep the server up even if the requests have been read--force-quit, -q      stop the server even if the requests have not been read--console             run a python console (default)--module MODULE, -m MODULErun library module as a script (the next args are passed to pytest as is)--script SCRIPT       run a script (the next args are passed to the script as is)web interaceClic on the⚙button on the top right of the page.Some options are available:Hide the netloc in the urlHide the initiator rowsTo keep your configuration, bookmark the page with the full search query.Fox example, if you want to hide the initiator rows by default, the url will be:http://localhost:4909/?hi=onweb interfaceAll the requests recorded are available on the web interface.The requests:are still available in the web page even if the python process stopped (except if you force quit before the requests have been loaded by the web page).are automatically cleaned if a new execution is detected.documentationhttps://httpdbg.readthedocs.io