Skip to main content

Mockpy is a python open source line utility to quickly create mock servers on Mac OS X.

Project description

# Mockpy

[![Build Status](](

Mockpy is a python open source line utility to quickly create mock servers on Mac OS X.
Mockpy is inspired by wiremock and uses libmproxy for the proxy functionality.

mockpy works by reading a list of configuration files in the YAML format, it uses these configurations to match the http request received and return an http response based on the matched YAML file configuration.

# Why mockpy
- You want a very lightweight utility to quickly create a mock API
- No need to edit your app code as it uses proxy mocking
- Works on top of proven technology ([mitmproxy]( and [cherrypi](
- Update to the mock API are picked up from files without the need to start/restart the server again.

# Installation

Mockpy can be installed as a python wheel using `pip` or as a standalone binary using `homebrew`

## Installing with pip

Make sure you have [pip]( installed.

Run the following to install mockpy

pip install mockpy

## Installing using brew
Install using brew tap

brew tap oarrabi/tap
brew install mockpy

# Usage

Bellow is a description of the basic operations that `mockpy` provides, for a more complete understanding please refer to [the wikis](

## Initialize a directory
Initialize a the current folder by running:

mockpy init
This will create two folders:

`inout`: this folder will contains a list of mapping YAML files, each YAML file represents an request and response operation.

`res`: resource folder contains the static HTML, JSON, Images and static files returned as part of the mocking process.

To understand the YAML file format, please refer to the documentation.

## Start the mock server
The mock server can be started as a standalone web server, or as a proxy server.

### Standalone web server
Use `mockpy start` to start the standalone web server, this will setup a server on the default port. Visit `` to check the mock server.

### Proxy web server
To start mockpy in proxy server mode use `mockpy start -x`. This command does the following:
- Starts a proxy server on ''
- Sets the macs HTTP/HTTPS settings to the created proxy server.


0.1.0 (2015-01-11)

* First release on PyPI.

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 mockpy, version 0.1.7
Filename, size File type Python version Upload date Hashes
Filename, size mockpy-0.1.7-py2-none-any.whl (19.8 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size mockpy-0.1.7.tar.gz (12.1 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