wiremock-mock
Serve WireMock stubs with 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 http import HTTPStatus
from typing import Any
import requests
import responses
from wiremock_mock import add_wiremock_to_responses
stubs: dict[str, Any] = {
"mappings": [
{
"request": {"method": "GET", "urlPath": "/v1/pages"},
"response": {
"status": 200,
"jsonBody": {"object": "list", "results": []},
},
},
],
}
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 http import HTTPStatus
from typing import Any
import httpx
import respx
from wiremock_mock import add_wiremock_to_respx
stubs: dict[str, Any] = {
"mappings": [
{
"request": {"method": "GET", "urlPath": "/v1/pages"},
"response": {
"status": 200,
"jsonBody": {"object": "list", "results": []},
},
},
],
}
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
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 or respx for httpx 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 integration; responses does not provide a custom reason-phrase hook.
Full documentation
See the full documentation for more information including how to contribute.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wiremock_mock-2026.8.16.tar.gz.
File metadata
- Download URL: wiremock_mock-2026.8.16.tar.gz
- Upload date:
- Size: 131.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d00eb7ba2acaa32cd59369dbb323d45195551c9dabb22afd920771d4d20ed66
|
|
| MD5 |
2ab5c5505fbe36a43de95e06a83d377e
|
|
| BLAKE2b-256 |
6c4eff95c3003dc8c6355beada97e9afa778390653073bb20743aeb6969024fd
|
Provenance
The following attestation bundles were made for wiremock_mock-2026.8.16.tar.gz:
Publisher:
release.yml on adamtheturtle/wiremock-mock
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wiremock_mock-2026.8.16.tar.gz -
Subject digest:
4d00eb7ba2acaa32cd59369dbb323d45195551c9dabb22afd920771d4d20ed66 - Sigstore transparency entry: 2486327714
- Sigstore integration time:
-
Permalink:
adamtheturtle/wiremock-mock@33fbc6622976e57221666952b67d119cdc09a13b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/adamtheturtle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@33fbc6622976e57221666952b67d119cdc09a13b -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file wiremock_mock-2026.8.16-py3-none-any.whl.
File metadata
- Download URL: wiremock_mock-2026.8.16-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2ac8652f8e582f3f02394b8a08c303a2e1c5fd06c3d7282a89fc78ebeaa524d
|
|
| MD5 |
fd0f35663d3c3151d9dbad61d97f2510
|
|
| BLAKE2b-256 |
dc81d20068a536c22bfb85c24b214ef6425d59906a0b5fa459cfbcc78146d568
|
Provenance
The following attestation bundles were made for wiremock_mock-2026.8.16-py3-none-any.whl:
Publisher:
release.yml on adamtheturtle/wiremock-mock
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wiremock_mock-2026.8.16-py3-none-any.whl -
Subject digest:
f2ac8652f8e582f3f02394b8a08c303a2e1c5fd06c3d7282a89fc78ebeaa524d - Sigstore transparency entry: 2486328123
- Sigstore integration time:
-
Permalink:
adamtheturtle/wiremock-mock@33fbc6622976e57221666952b67d119cdc09a13b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/adamtheturtle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@33fbc6622976e57221666952b67d119cdc09a13b -
Trigger Event:
workflow_dispatch
-
Statement type: