Skip to main content

allow you to easily mock HTTP responses in your tests

Project description

responses_proxy allow you to easily mock HTTP responses in your tests


With pip:

$ pip install responses_proxy

Using docker:

$ docker run --rm -v tests/responses:/tests/responses bearstech/responses_proxy -h


Check command line arguments:

$ responses-proxy -h

First save some stuff using the proxy mode:

$ responses-proxy --proxy

If your target site use ssl then use:

$ responses-proxy --proxy --use-ssl

The proxy do not support ssl so you need to make http request. But first set the HTTP_PROXY env var:

$ export HTTP_PROXY=http://localhost:3333

Then run some code to make some requests:

python -c "import requests; requests.get('')"

This will generate some file in tests/responses/

NB: With docker you’ll have to mount the volume:

$ docker run --rm -v tests/responses:/tests/responses bearstech/responses_proxy

You can now restart the server without the proxy mode and the client will react the same way without calling the real server.

You can aslo use a RequestsMock in you unit tests:

import responses_proxy
import requsests

def test_url():
    with responses_proxy.RequestsMock():
        # https will work to. both are registered

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 responses_proxy, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size responses_proxy-0.1.4.tar.gz (12.1 kB) File type Source Python version None Upload date Hashes View
Filename, size responses_proxy-0.1.4-py2.py3-none-any.whl (6.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page