responses vs httmock

Python requests HTTP mocking libraries compared

responses and httmock intercept HTTP calls made with Python's `requests` library and provide mocked responses for tests. responses documents more request-matching, callback, call-inspection, and response-sequencing options, while httmock offers URL-based matching and configurable response helpers.

responseshttmock
LanguagePythonPython
LicenseApache-2.0—
Stars4.3k471
Forks38657
Last analyzedOct 3, 2026Oct 19, 2026

Key differences

  • responses supports matching request bodies, headers, query parameters, multipart data, fragments, and selected arguments; httmock documents URL matching with `urlmatch`.
  • responses supports callbacks, recorded call inspection, call-count assertions, and ordered response registries; httmock documents response handlers using `HTTMock` and `all_requests`.
  • responses can be activated with a decorator, context manager, or explicit start and stop calls; httmock documents activation through an `HTTMock` context manager.
  • responses requires Python 3.8 or newer and `requests` 2.30.0 or newer; httmock documents Python 2.7 and Python 3.4+ support.
  • responses lists its license as Apache-2.0; httmock lists its license as `NOASSERTION`, which should be verified before adoption where licensing matters.
  • responses reports 4.3k stars and 386 forks; httmock reports 472 stars and 56 forks.

Choose responses if you…

  • need detailed request matching, including bodies, headers, and query parameters.
  • want callbacks, call assertions, or ordered responses to model changing server behavior.
  • need passthrough rules or want to record and replay responses, noting that recording and replay are labeled beta.
Read the responses analysis →

Choose httmock if you…

  • want URL-based matching with `urlmatch` or handling all requests with `all_requests`.
  • need mocked responses with configurable status, content, headers, or cookies.
  • need a project whose README documents Python 2.7 support, or Python 3.4+ support, and will verify compatibility with your environment.
Read the httmock analysis →

Compare the numbers side by side, or add more projects

This comparison is generated with AI from the OSRepos analyses of both projects. Always check each project's repository and documentation before choosing.