Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Simple mock server for REST API

Project description

Mock server

Simple mock server for REST and XML-RPC API

It can mock GET, POST, PUT, PATCH, DELETE and some more rarely used HTTP methods.

Build status at Travis CI: travis


Install with pip:

$ pip install mock-server

Or install with easy_install:

$ easy_install mock-server

And after run:

$ mock-server --dir=/path/to/api

It will be listening on port 8888 and wait for your HTTP requests.


For create mock for url path go to:

Mocked GET /user/tom:

$ curl -v -X GET

> GET /user/tom HTTP/1.1
> Host:
> Accept: */*
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Content-Type: application/json; charset=utf-8
< Content-Length: 64
< Server: TornadoServer/2.4.1
    "name": "Tom",
    "surname": "Smith",
    "age": 22


  • Mocking REST API.
  • Mocking RPC API (xml, json).
  • Upstream server proxy (proxy an existing api).
  • Variables in url path.
  • Simple api documentation (markdown).
  • Api authentication (HTTP Basic authentication).


response content format: %METHOD%_%STATUS%.%FORMAT%

response headers format: %METHOD%_H_%STATUS%.%FORMAT%

    GET_200.json         # response content for GET /
    GET_H_200.json       # headers for GET /
        DELETE_404.xml   # response content for DELETE /user.xml?__statusCode=404
        POST_200.json    # response content for POST /user
        POST_H_200.json  # headers for POST /user

Bug report

If you have any trouble, report bug at GitHub Issue


William Zhang



  • support for custom response provider


  • support for non-standard status codes


  • added num_processes command line option for possibility to start multiple worker processes


  • edit rpc method fix


  • create resource quotation character fix


  • todo escaping fix


  • support for todos in api documentation
  • access log improvements


  • upstream server proxy (proxy an existing api)
  • variables in url path
  • simple api documentation (markdown)
  • api authentication (HTTP Basic authentication)
  • manage interface improvements

No notes on earlier releases.

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
mock-server-0.3.7.tar.gz (369.5 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page