Skip to main content

A utility for mocking out the Python HTTPX and HTTP Core libraries.

Project description


Mock HTTPX with awesome request patterns and response side effects.

codecov PyPi Version Python Versions


Full documentation is available at


RESPX is a simple, yet powerful, utility for mocking out the HTTPX, and HTTP Core, libraries.

Start by patching HTTPX, using respx.mock, then add request routes to mock responses.

import httpx
import respx

from httpx import Response

def test_example():
    my_route = respx.get("").mock(return_value=Response(204))
    response = httpx.get("")
    assert my_route.called
    assert response.status_code == 204

Read the User Guide for a complete walk-through.


Install with pip:

$ pip install respx

Requires Python 3.6+ and HTTPX 0.15+. See Changelog for older HTTPX compatibility.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for respx, version 0.16.3
Filename, size File type Python version Upload date Hashes
Filename, size respx-0.16.3-py2.py3-none-any.whl (27.1 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size respx-0.16.3.tar.gz (21.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page