Skip to main content

A very simple tool to debug HTTP(S) client requests

Project description

Build Status PyPI version Coverage Status

httpdbg

A very simple tool to debug HTTP(S) client requests.

installation

pip install httpdbg

usage

interactive console

Open an interactive console using the following command: pyhttpdbg

(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 linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> 

Perform HTTP requests.

You can inspect the HTTP requests directly in your web browser at http://localhost:4909.

script

You can trace all the HTTP requests performed by a script

pyhttpdbg --script filename.py [arg1 --arg2 ...]

pytest

You can trace all the HTTP requests performed during your tests

pyhttpdbg -m pytest [arg1 --arg2 ...]

note: the HTTP(S) requests are not recorded if the tests are executed in parallel using plugin like xdist.

module

You can trace all the HTTP requests performed by a library module run as a script using the -m command line argument.

For example, you can view which HTTP requests are performed by pip when you install a package.

pyhttpdbg -m pip install httpdbg --upgrade

Initiators

An 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 -i command line argument:

pyhttpdbg -i api_client_pck --script my_script.py

You can use any package as an initiator, this is not limited to HTTP requests.

Already supported packages

packages status
requests supported
urllib3 supported
httpx supported
aiohttp supported
pytest supported
your_package yes, with the arg -i your_package

configuration

No configuration is necessary to start but some few settings are available for particular use.

command line

usage: 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 requests

options:
  -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 INITIATOR
                        add 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 MODULE
                        run 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 interace

Clic on the button on the top right of the page.

Some options are available:

  • Hide the netloc in the url
  • Hide the initiator rows

To 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=on

web interface

All 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.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

httpdbg-0.11.0.tar.gz (50.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

httpdbg-0.11.0-py3-none-any.whl (53.3 kB view details)

Uploaded Python 3

File details

Details for the file httpdbg-0.11.0.tar.gz.

File metadata

  • Download URL: httpdbg-0.11.0.tar.gz
  • Upload date:
  • Size: 50.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for httpdbg-0.11.0.tar.gz
Algorithm Hash digest
SHA256 b5f57a13d31e9835769d3367c7a8076872d847e7934255069a1097034b938cb4
MD5 7c476104cd481d08af247ec15dac1ab2
BLAKE2b-256 b626370a540ca45c4763571a3302418ec30e88e8b75974f2b9d6c3514471ad9c

See more details on using hashes here.

File details

Details for the file httpdbg-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: httpdbg-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 53.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for httpdbg-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 037034bf1fd3dda9097af3536311c349618ceafc912dff17cc6e9d83e4853442
MD5 c454d76363140102ec0b05ee11ff5901
BLAKE2b-256 5269c67744945dfa85f7b6a18835fe9ee52546914311379fb17fdf0d2c4bd0ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page