patrys

httmock: Mock HTTP Requests for Python Tests

httmock is a Python library built on requests for mocking HTTP interactions in tests. It lets you provide conditional or catch-all mocked responses when testing code that calls APIs through requests.

InactivePythonLibraryTestingAPI
View on GitHub Compare
Stars
471
Forks
57
Stars, last 28 days
-1
Last commit
3.1 years ago
Contributors
23

Our take

Inactiveno commits in over a year

Health score

29/100

How it is scored
Activity
20
Community
53
Issues
21
Pull requests
21

-1 stars in the last 28 days

httmock offers a focused way to mock requests calls, but its inactive maintenance status makes it important to check compatibility before adopting it for new work.

Good fit if

  • Your Python code makes HTTP calls through requests and you want to supply mocked responses in tests.
  • You need URL-based handlers or a catch-all handler, and the library works with your Python environment.
  • You can assess and manage the risk of depending on a project with no recent commits or releases.

Look elsewhere if

  • You need evidence of active maintenance or recent issue and pull request activity. The project is marked inactive, with no recent commits, releases, issue closures, or merged pull requests.
  • You require a clearly established license. GitHub reports the license as NOASSERTION.
  • You need documented CI or test setup; neither is detected in the supplied project facts.
All health signals
Last commit2023-09-29 (3.1 years ago)
Commits, last 90 days0
Releases, last 12 months0
Contributors23 (top contributor: 63% of commits)
Issues closed, last 90 days0
Pull requests merged, last 90 days0
Project age13 years

Checked on 2026-10-19 with the GitHub API.

Project history

Daily GitHub snapshots since Oct 7, 2026. History covers stars and forks; health signals are not tracked historically.

Selected snapshot

Stars

471

Forks

59

Change since Nov 3, 2026: 0 stars·0 forks

Overview

httmock is a Python mocking library built on the requests HTTP library. It helps Python developers test code that makes HTTP calls through requests, including libraries that contact third-party APIs, without relying on live services for the mocked interactions.

Handlers can match requests by URL or intercept all requests in a test context, then return response content, status codes, headers, and cookies. The README describes support for Python 2.7 and Python 3.4+.

Key Features

  • Intercepts HTTP calls made with requests within an HTTMock context.
  • Matches requests conditionally with the urlmatch decorator.
  • Uses all_requests to handle requests without URL-based matching.
  • Builds responses from dictionaries or with the response helper.
  • Supports response status codes, content, headers, and cookies.
  • Can be used to test libraries that use requests internally.

Use Cases

  • Python developers testing API clients can substitute mocked responses for live API calls.
  • Library maintainers can test code that uses requests without needing the external service to respond.
  • Teams can check how their code handles API errors by returning responses with chosen status codes and content.
  • Developers can test cookie handling and response parsing with controlled headers and bodies.

What you need

Detected in the repository

  • Python (from setup.py)

Getting Started

Install from PyPI:

pip install httmock

See the README for usage details.

License in Plain Words

No standard license was detected. Without a license, the default copyright rules apply: you may read the code, but not reuse it. Check the repository or ask the authors.

Alternatives

  • HTTPretty: HTTPretty intercepts HTTP traffic at the socket level, while httmock targets requests-based HTTP interactions.
  • python-mocket: Mocket intercepts socket and SSL traffic for multiple clients and protocols, while httmock focuses on the requests library.
  • responses: Responses also mocks requests calls, with features such as callbacks and ordered responses; httmock provides conditional or catch-all mocks.
ProjectLanguageLicenseStarsStatus
httmockPython–471Inactive
HTTPrettyPythonMIT2.1kInactive
python-mocketPythonBSD-3-Clause311Active
responsesPythonApache-2.04.3kActive

Considerations

The repository is marked inactive, and there have been no commits in over a year or releases recorded in the past year. Although the project has multiple contributors and is not flagged as concentrated around one contributor, the supplied activity data shows no recent issue closures or merged pull requests. Check the code and your dependency requirements before relying on it. The license is reported as NOASSERTION, so review the repository's license files and confirm the terms before use. The README describes Python 2.7 and 3.4+ support, but the supplied project facts do not identify CI or tests.

Found this useful?

Share it with someone who would like httmock.

Comparisons