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:
DEMO
Installation
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.
Overview
Mocked GET /user/tom:
$ curl -v -X GET http://demo.mockapi.org/user/tom
> GET /user/tom HTTP/1.1
> Host: demo.mockapi.org
> 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
}
Features
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).
Release new version
Format
response content format: %METHOD%_%STATUS%.%FORMAT%
response headers format: %METHOD%_H_%STATUS%.%FORMAT%
root_dir/
GET_200.json # response content for GET /
GET_H_200.json # headers for GET /
user/
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 https://github.com/tomashanacek/mock-server/issues
Contributors
William Zhang
History
0.3.9
fix unicode 500 error
fix grammar when API does not exist
Many thanks to @bopo and @krmaxwell
0.3.8
fix http util when returning HTTPHeaders instance
fix Tornado version
Python 2.7 and 3.4 compatibility
Many thanks to @eduardosan and @winkidney
0.3.7
support for custom response provider
0.3.6
support for non-standard status codes
0.3.5
added num_processes command line option for possibility to start multiple worker processes
0.3.4
edit rpc method fix
0.3.3
create resource quotation character fix
0.3.2
todo escaping fix
0.3.1
support for todos in api documentation
access log improvements
0.3
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.
Metadata
Release files for mock-server 0.3.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mock-server-0.3.9.tar.gz | 341.6 kB | Without provenance | Details for mock-server-0.3.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mock_server-0.3.9-py2-none-any.whl | Python 2 | none | any | Details for mock_server-0.3.9-py2-none-any.whl |
Total release size: 716.5 kB
Release files / mock-server-0.3.9.tar.gz
| Download URL | mock-server-0.3.9.tar.gz |
|---|---|
| Size | 341.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5e80f133f783e2583878b072cfa0c150657f41ab44484cc86ac6243180387c3a
|
|
BLAKE2b-256 checksum How to use checksums |
8fa8d056f867e247e12f9856cd6429b5093a76b3d01875d49ed31ac457b50457
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / mock_server-0.3.9-py2-none-any.whl
| Download URL | mock_server-0.3.9-py2-none-any.whl |
|---|---|
| Size | 374.8 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
53687796323f2b49a0673a6b53529a1199c820a0f37027ad712905a16c98fbaa
|
|
BLAKE2b-256 checksum How to use checksums |
d3801a43d8926d35495dd3e8bff116a02d9f6a2db43e9998916090c9873a2d7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for mock-server 0.3.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.