wiremock-mock
Serve WireMock stubs with HTTPX2, responses or respx.
Requires Python 3.12+.
Installation
uv pip install wiremock-mock
Or with pip:
pip install wiremock-mock
Usage
requests with responses
"""Use WireMock stubs with requests and responses."""
from collections.abc import Mapping
from http import HTTPStatus
import requests
import responses
from wiremock_mock import add_wiremock_to_responses
stubs: Mapping[str, object] = {
"mappings": [
{
"request": {"method": "GET", "urlPath": "/v1/pages"},
"response": {
"status": 200,
"jsonBody": {
"object": "list",
"results": list[object](),
},
},
},
],
}
with responses.RequestsMock(assert_all_requests_are_fired=False) as m:
add_wiremock_to_responses(
mock_obj=m, stubs=stubs, base_url="http://notion-mock.test"
)
response = requests.get(url="http://notion-mock.test/v1/pages", timeout=1)
assert response.status_code == HTTPStatus.OK # noqa: S101
The standard responses decorator workflow is also supported by passing responses.mock while @responses.activate is active.
httpx with respx
"""Use WireMock stubs with httpx and respx."""
from collections.abc import Mapping
from http import HTTPStatus
import httpx
import respx
from wiremock_mock import add_wiremock_to_respx
stubs: Mapping[str, object] = {
"mappings": [
{
"request": {"method": "GET", "urlPath": "/v1/pages"},
"response": {
"status": 200,
"jsonBody": {
"object": "list",
"results": list[object](),
},
},
},
],
}
with respx.mock(
base_url="http://notion-mock.test", assert_all_called=False
) as m:
add_wiremock_to_respx(
mock_obj=m, stubs=stubs, base_url="http://notion-mock.test"
)
response = httpx.get(url="http://notion-mock.test/v1/pages")
assert response.status_code == HTTPStatus.OK # noqa: S101
HTTPX2 with a native mock transport
"""Use WireMock stubs with HTTPX2."""
from collections.abc import Mapping
from http import HTTPStatus
import httpx2
from wiremock_mock import create_httpx2_transport
stubs: Mapping[str, object] = {
"mappings": [
{
"request": {"method": "GET", "urlPath": "/v1/pages"},
"response": {
"status": 200,
"jsonBody": {
"object": "list",
"results": list[object](),
},
},
},
],
}
transport = create_httpx2_transport(
stubs=stubs, base_url="http://notion-mock.test"
)
with httpx2.Client(transport=transport) as client:
response = client.get(url="http://notion-mock.test/v1/pages")
assert response.status_code == HTTPStatus.OK # noqa: S101
These integrations let you use existing WireMock stub files (e.g. from the WireMock Admin API import format) without running WireMock in Docker. HTTP traffic is mocked through responses for requests clients, respx for httpx clients, or a native mock transport for httpx2 clients. To load stubs from a JSON file, use json.loads(path.read_text()).
Use cases
Use existing WireMock stub files without running WireMock in Docker
Test against external APIs (e.g. Notion) without network access
Reuse stubs exported from WireMock Admin API or recorded mappings
Run tests in CI without Docker/socket dependencies
Supported stub features
Request matching: method, urlPath (exact), urlPathPattern (regex)
Query parameters: queryParameters with equalTo
Request body: bodyPatterns with equalToJson (honouring ignoreArrayOrder and ignoreExtraElements), contains and equalTo. This lets two requests to the same method and URL return different responses based on their bodies.
Response: status, statusMessage, single- or multi-value headers, jsonBody, body, base64Body
statusMessage is supported by the respx and HTTPX2 integrations. Responses does not provide a custom reason-phrase hook.
Full documentation
See the full documentation for more information including how to contribute.
Metadata
Release files for wiremock-mock 2026.10.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wiremock_mock-2026.10.9.tar.gz | 139.4 kB | With provenance | Details for wiremock_mock-2026.10.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wiremock_mock-2026.10.9-py3-none-any.whl | Python 3 | none | any | Details for wiremock_mock-2026.10.9-py3-none-any.whl |
Total release size: 149.0 kB
Release files / wiremock_mock-2026.10.9.tar.gz
| Download URL | wiremock_mock-2026.10.9.tar.gz |
|---|---|
| Size | 139.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea95e3b71b5ecdfeb6bc5d747333b5156c48769e9010681680042e3691af5373
|
|
BLAKE2b-256 checksum How to use checksums |
ce3277700fd0d0e96a120624ece7ba9a8bbc992a33d4410209e048b433502ab0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 9, 2026.
Transparency logRelease files / wiremock_mock-2026.10.9-py3-none-any.whl
| Download URL | wiremock_mock-2026.10.9-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3d4b610fe9c5f2292fc236708f74659188aec6037d2fc73b104b22f7747ed4d1
|
|
BLAKE2b-256 checksum How to use checksums |
df2c26a06b42a7ff3f2b62d04d0368d1d67b5f79d94715302393477e8bf13157
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 9, 2026.
Transparency logSecurity for wiremock-mock 2026.10.9
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for wiremock_mock-2026.10.9.tar.gz
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 Oct 9, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.