CheckOps home

Tools directory

R

CheckOps

responses

responses is an Apache-2.0 Python library from Sentry for mocking the Requests HTTP library, letting tests register fake responses, match request details and assert on calls.

Visit website

Latest public signals

Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.

Visit Website

Introduction

responses is a utility for mocking out the Python Requests library, maintained by Sentry. It intercepts calls made with requests so tests never hit real servers; you register the responses you expect, and any unregistered request raises a ConnectionError, which makes accidental network calls obvious.

You activate it with the @responses.activate decorator or as a context manager, then call responses.add(...) (or helpers such as responses.get(...)) with the method, URL, status, body or JSON and headers. Matchers in responses.matchers check request details such as JSON bodies (json_params_matcher), URL-encoded form data and query parameters, so a stub only answers correctly formed requests. Callbacks generate dynamic responses, responses.calls records what was sent, registries control ordering, and options such as assert_all_requests_are_fired and passthrough prefixes are available on the mock. Version 0.26.3 was released on 26 August 2026.

The source code is at getsentry/responses on GitHub under the Apache-2.0 licence, with about 4,300 stars; the most recent commit was on 3 November 2026.

Features

  1. Requests mocking: Intercepts the requests library without network calls.
  2. Request matchers: Match JSON, form data and query parameters.
  3. Call inspection: responses.calls records requests for assertions.
  4. Strict by default: Unregistered requests fail loudly.

Pros

  1. Free to use: Open source under the Apache-2.0 licence, so the core tool costs nothing to use.
  2. Actively maintained: The repository had commits as recent as 3 November 2026.
  3. Community: About 4,300 GitHub stars.

Cons

  1. Requests only: Does not mock httpx, aiohttp or urllib directly.
  2. Manual stubs: Large APIs need many registrations; VCR.py records them instead.
import requests
import responses
from responses import matchers

@responses.activate
def test_create_user():
    responses.post(
        "https://api.example.com/users",
        json={"id": 1},
        status=201,
        match=[matchers.json_params_matcher({"name": "Ana"})],
    )
    r = requests.post("https://api.example.com/users", json={"name": "Ana"})
    assert r.status_code == 201
    assert len(responses.calls) == 1

Resources:

Pricing

responses is free and open source under the Apache-2.0 licence.

  1. Python code that uses requests and needs fast, isolated tests.
  2. Teams that want strict checks that requests are well formed.

Conclusion

responses is the go-to mocking library for requests-based Python code, simple, strict and well maintained by Sentry.

Alternatives

Other tools on CheckOps that cover similar ground. Open a page, or compare one with responses side by side.