pytest-httpdbg
A pytest plugin for recording HTTP(S) requests and saving them in your test report.
installation
pip install pytest-httpdbg
Allure report
If you use the allure-pytest plugin to generate an Allure report, you can use pytest-httpdbg to include HTTP request traces in your test report without any code modifications.
All you need to do is add the --httpdbg-allure option to your pytest command line:
pytest ../httpdbg-docs/examples/ --alluredir=./allure-results --httpdbg-allure
If an HTTP request is made by the test (or within a fixture, during the setup or teardown phase), a HTTP traces report will be saved in the Allure report under a step called httpdbg.
compact mode
full mode
Custom test report
You can add HTTP traces to any test report of your choice. To do this, you can use the HTTP traces saved by the plugin in Markdown format.
When a test finishes (including the teardown step), a log file in Markdown format is generated. The path to this log file is stored in the test item when the test starts (before the setup step), even if the file does not yet exist.
pytest-html
You can copy the following code in your top-level conftest.py to include the logs into your pytest-html report.
import os
import pytest
from pytest_httpdbg import httpdbg_record_filename
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
pytest_html = item.config.pluginmanager.getplugin("html")
outcome = yield
report = outcome.get_result()
extras = getattr(report, "extras", [])
if call.when == "call":
if httpdbg_record_filename in item.stash:
extras.append(
pytest_html.extras.url(
os.path.basename(item.stash[httpdbg_record_filename]),
name="HTTPDBG",
)
)
report.extras = extras
This example works if you use the same directory for the html test report file and the httpdbg logs.
pytest demo/ --httpdbg --httpdbg-dir report --html=report/report.html
If this is not the case, you must adapt it to your configuration.
pytest command line options
reporting:
--httpdbg record HTTP(S) requests
--httpdbg-dir=HTTPDBG_DIR save httpdbg traces in a directory
--httpdbg-no-clean do not clean the httpdbg directory
--httpdbg-allure save HTTP(S) traces into the allure report
--httpdbg-only-on-failure save the HTTP requests only if the test failed
--httpdbg-initiator=HTTPDBG_INITIATOR add a new initiator (package) for httpdbg
httpdbg
This plugin is based on the httpdbg Python tool. You can use it to trace all HTTP requests in your tests and view them in a more detailed user interface using the pyhttpdbg command.
pyhttpdbg -m pytest -v examples/
documentation
https://httpdbg.readthedocs.io/en/latest/test/#pytest-httpdbg
Release files for pytest-httpdbg 0.10.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_httpdbg-0.10.3.tar.gz | 10.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_httpdbg-0.10.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.5 kB
Release files / pytest_httpdbg-0.10.3.tar.gz
| Download URL | pytest_httpdbg-0.10.3.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e50d8616701fd86aec0bcb981964297449bdbee570334c94b0d4d1addf563870
|
|
BLAKE2b-256 checksum How to use checksums |
7513a37b0302d887026baf8846870ab148bb9ae5d26956200ca378cb7de16eb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 6, 2026.
Transparency logRelease files / pytest_httpdbg-0.10.3-py3-none-any.whl
| Download URL | pytest_httpdbg-0.10.3-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
41b79e4335168ed3b55853edd71e2dda00c5ae4fc86350a96be99fbd7c5806cc
|
|
BLAKE2b-256 checksum How to use checksums |
bebe55d6351a9bf20e5af89f40605fd5d9abdf3173997006d26c011c37f25a26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 6, 2026.
Transparency log