NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #405 most downloaded on PyPI
A utility library for mocking out the `requests` Python library.
Last release 1 months ago
26 Aug 2026
Ships fairly regularly
a new release about every 3 months
Nearly every release is documented
notes for 59 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
13 years old
65 releases · first in 2013
Added a keep_headers argument to _recorder.record and Recorder.dump_to_file to preserve named headers (for example Date ) that are otherwise stripped
keep_headers argument to _recorder.record andRecorder.dump_to_file to preserve named headers (for example Date)CallList so static type checkers inferCall values when iterating, indexing, or filtering recorded calls. See #722query_string_matcher (and the query matching auto-applied to ab=), which caused requests with an extra or missing blank param tofragment_identifier_matcher treating opaque fragments (those without=, e.g. /users/5) as always equal, so a required fragment matched akeep_headers argument to _recorder.record and
Recorder.dump_to_file to preserve named headers (for example Date)
that are otherwise stripped as verbose defaults, so a signed response can be
recorded and later verified. Matching is case-insensitive. See #763CallList so static type checkers infer
Call values when iterating, indexing, or filtering recorded calls. See #722query_string_matcher (and the query matching auto-applied to a
registered URL's own query string) discarding blank-valued query params
(b=), which caused requests with an extra or missing blank param to
match incorrectly. See #804fragment_identifier_matcher treating opaque fragments (those without
=, e.g. /users/5) as always equal, so a required fragment matched a
different one or none at all. See #806json_params_matcher raising TypeError when an actual
nested object is compared with an expected scalar value.One column per quarter.
Default headers (such as Content-Type , Date and Server ) are now stripped from recorded files regardless of header name case. Previously, responses r
Content-Type, Date and Server) are now strippedquery_param_matcher mutating the caller's params dict when numericAdded Spanish translation of the README ( README.es.rst )
README.es.rst)content_type and headers['content-type'] are in a response mock file,content_type is now used.When using assert_all_requests_are_fired=True , assertions about unfired requests are now raised even when an exception occurs in the context manager
assert_all_requests_are_fired=True, assertions aboutRetry-After header when handling retriesFix bug where the content type is always recorded as either text/plain or application/json. See #770
Added support for python 3.13
* Added py.typed to package_data
Fix readme issue that prevented 0.25.4 from being published to pypi.
Fixed recorder not saving and loading response headers with yaml files. See #715
recorder not saving and loading response headers with yaml files. See #715Mulligan on 0.25.1 to run release pipeline correctly.
matchers.body_matcher for matching string request bodies. See #717Fixed matchers.header_matcher not failing when a matched header is missing from the request. See #702
matchers.header_matcher not failing when a matched header is missing from the request. See #702Added typing to Call attributes.
Call attributes.Added BaseResponse.calls to access calls data of a separate mocked request. See #664
BaseResponse.calls to access calls data of a separate mocked request. See #664real_adapter_send parameter to RequestsMock that will allow users to set
through which function they would like to send real requestsjson_params_matcher.Content-Type headers issue when the header was duplicated. See #644tests_requires* Allow urllib3>=1.25.10
> This release is the last to support Python 3.7
This release is the last to support Python 3.7
unbound_on_send method in RequestsMock class. This method returns new function
that is called by RequestsMock instead of original send method defined by any adapter.* Remove tomli import. See #630
tomli import. See #630Fix type annotations of CallList. See #593
CallList. See #593request object is attached to any custom exception provided as Response body argument. See #588assert_all_requests_are_fired and a request was not fired.responses.RequestsMock._parse_response_file and
responses._recorder.Recorder.dump_to_file methods that allow users to override default parser to eg toml, jsonUpdate requests dependency to the version of 2.22.0 or higher. See #584.
requests dependency to the version of 2.22.0 or higher. See #584.@_recorder.record(file_path="out.toml") decorator.responses._add_from_file(file_path="out.toml") method.mock's patcher object. See #556CallListpassthrough argument to BaseResponse object. See #557registries leak. See #563OriginalResponseShim is removed. See #585loose version of json_params_matcher via named argument strict_match. See #551json_params_matcher. See #559delete, get, head, options, patch, post, put shortcuts are now implemented using functools.partialmethod.MaxRetryError exception. Replace exception by RetryError according to requests implementation. See #572.Retry is exhausted. See #580.Add threading.Lock() to allow responses working with threading module.
threading.Lock() to allow responses working with threading module.urllib3 Retry mechanism. See #135_cookies_from_headers functionadd, upsert, replace methods return registered response.
remove method returns list of removed responses.urlencoded_params_matcher via allow_blank keyword argument@responses.activate(assert_all_requests_are_fired=True)
to your function to validate that all requests were executed in the wrapped function. See #183Deprecate responses.assert_all_requests_are_fired, responses.passthru_prefixes, responses.target since they are not actual properties of the class ins…
responses.assert_all_requests_are_fired, responses.passthru_prefixes, responses.target
since they are not actual properties of the class instance.
Use responses.mock.assert_all_requests_are_fired,
responses.mock.passthru_prefixes, responses.mock.target instead.reset() method was called in not stopped mock. See #511Added a registry that provides more strict ordering based on the invocation index. See responses.registries.OrderedRegistry.
responses.registries.OrderedRegistry.responses.post() instead
of responses.add(responses.POST).responses.activate decorator to leak, if wrapped function called from within another
wrapped function. Also, allow calling of above mentioned chain. See #481 for more details.get_registry() method of RequestsMock object. Replaces internal _get_registry().query_param_matcher can now accept dictionaries with int and float values.loose version of query_param_matcher via named argument strict_match.async/await functions.response_callback is no longer executed on exceptions raised by failed Responses_get_url_and_path to comply with RFC 3986. Now URL match occurs by matching
schema, authority and path, where path is terminated by the first question mark ("?") or
number sign ("#") character, or by the end of the URI.content_type and headers[content-type] are provided as parameters.Fix issue when Deprecation Warning was raised with default arguments in responses.add_callback due to match_querystring. See #464
responses.activate decorator. See #468_is_string and _ensure_str functions_quote from test_responses.py_matches attribute of RequestsMock object.responses.add_callback due to match_querystring. See #464Deprecate match_querystring argument in Response and CallbackResponse. Use responses.matchers.query_param_matcher or responses.matchers.query_string_m…
response.iter_content when chunk_size=None entered infinite looppassthru_prefixes persisted across tests.
Now add_passthru is valid only within a context manager or for a single function and
cleared on exitmatch_querystring argument in Response`` and CallbackResponse. Use responses.matchers.query_param_matcherorresponses.matchers.query_string_matcher`responses.matchers.multipart_matcherresponses.registries. Now user can create custom registries to
manipulate the order of responses in the match algorithm
responses.activate(registry=CustomRegistry)Fixed regression with stream parameter deprecation, requests.session() and cookie handling.
stream parameter deprecation, requests.session() and cookie handling.urllib.parse.match parameter to add_callback methodresponses.matchers.fragment_identifier_matcher. This matcher allows you
to match request URL fragment identifier.python-future is also installed.Deprecate stream argument in Response and CallbackResponse
responses.PassthroughResponse and
reponses.BaseResponse.passthrough. These features make building passthrough
responses more compatible with dynamcially generated response objects._is_redirect() function from responses internals.responses.matchers.request_kwargs_matcher. This matcher allows you
to match additional request arguments like stream.responses.matchers.multipart_matcher. This matcher allows you
to match request body and headers for multipart/form-data dataresponses.matchers.query_string_matcher. This matcher allows you
to match request query string, similar to responses.matchers.query_param_matcher.responses.matchers.header_matcher(). This matcher allows you to match
request headers. By default only headers supplied to header_matcher() are checked.
You can make header matching exhaustive by passing strict_match=True to header_matcher().stream argument in Response and CallbackResponseMoved responses.json_params_matcher to responses.matchers.json_param_matcher
responses.matchers.responses.json_params_matcher to responses.matchers.json_param_matcherresponses.urlencoded_params_matcher to
responses.matchers.urlencoded_param_matcherresponses.query_params_matcher. This matcher allows you to match
query strings with a dictionary.auto_calculate_content_length option to responses.add(). When
enabled, this option will generate a Content-Length header
based on the number of bytes in the response body.responses.matchers.responses.json_params_matcher to responses.matchers.json_params_matcherresponses.urlencoded_params_matcher to
responses.matchers.urlencoded_params_matcherresponses.matchers.query_param_matcher. This matcher allows you
to match query strings with a dictionary.auto_calculate_content_length option to responses.add(). When
enabled, this option will generate a Content-Length header
based on the number of bytes in the response body.Use URLs with normalized hostnames when comparing URLs.
Switch from Travis to GHA for deployment.
Fixed incorrect type stubs for add_callback
add_callbackFixed packages not containing type stubs.
responses.upsert() was added. This method will add() a response if one has not already been registered for a URL, or replace() an existing response.
responses.upsert() was added. This method will add() a response if one has not already been registered for a URL, or replace() an existing response.responses.registered() was added. The method allows you to get a list of the currently registered responses. This formalizes the previously private responses.mock._matches method.__repr__ has been added to Response.responses.urlencoded_params_matcher and responses.json_params_matcher now accept None to match empty requests.
responses.urlencoded_params_matcher and responses.json_params_matcher now
accept None to match empty requests.urllib3 versions.request.params now allows parameters to have multiple values for the same key.* Removed support for python 3.4
Added the match parameter to add().
match parameter to add().responses.urlencoded_params_matcher() and responses.json_params_matcher().Add a requirements pin to urllib3. This helps prevent broken install states where cookie usage fails.
Added assert_call_count to improve ergonomics around ensuring a mock was called.
assert_call_count to improve ergonomics around ensuring a mock was called.Version bump to align tags with setup.py
Fixed incorrect content-type in add_callback() when headers are provided as a list of tuples.
add_callback() when headers are provided as a list of tuples.Fixed invalid README formatted.
Fixed regression with add_callback() and content-type header.
add_callback() and content-type header.Fixed cookie parsing and enabled multiple cookies to be set by using a list of tuple values.
Improved formatting of project description in pypi.
Improved installation requirements for py3
test_responses.py is no longer part of the installation targets.Fix callback exception mocking.
Fixed generated wrapper when using @responses.activate in Python 3.6+ when decorated functions use parameter and/or return annotations.
@responses.activate in Python 3.6+
when decorated functions use parameter and/or return annotations.Fixed deprecation warnings in python 3.7 for inspect module usage.
Fixed build setup to use undeprecated pytest bin stub.
pytest bin stub.tox configuration.pytest.fixturebiscuits in py3. Instead http.cookies is being used.Fix release tooling to publish wheels as well.
The match_querystring argument for responses.add() now defaults to true if the stubbed URL has a query string.
match_querystring argument for responses.add() now defaults to true if the stubbed URL has a query string.Support streaming responses for BaseResponse
Nothing published for this version
Added the ability to passthru real requests via add_passthru() and passthru_prefixes configurations.
add_passthru()
and passthru_prefixes configurations.Responses will now be rotated until the final match is hit, and then persist using that response (GH-171).
Fixed call counting with exceptions (GH-163).
match_querystring (GH-166).Restored adding_headers compatibility (GH-160).
adding_headers compatibility (GH-160).Allow empty list/dict as json object (GH-100).
response_callback (GH-151).Response interfaces (GH-155).yapf autoformatting now enforced on codebase.Add LICENSE, README and CHANGES to the PyPI distribution (GH-97).
Allow passing a JSON body to response.add (GH-82)
response.add (GH-82)Mocking now happens on the adapter instead of the session
Add the ability to mock errors (GH-22)
responses.add_callback (GH-24)responses.activate decorator (GH-18)Your coding agent can read these notes before it upgrades. Set up the MCP server →