Charles + Python simple data mock

background

Client development, which often need mocksome data. Of course there are many platforms for us to choose. But sometimes we ourselves would like to quickly modify some of the data. Today introduced a more flexible and simple method for quickly mocksome data.

Charles direct useMap local

You can directly use Charlesthe Map local. Using the Local pathfunction, it will have direct access request data path at your own local configuration jsondata, the steps below:

Use Pythonto make a simple local service

I was used Python3.

First, build a folder, folder stored mockwith the jsonfile cdto the folder, use the following command to start the server listening 8010port:

python3 -m http.server 8010
复制代码

Then use Charlesthe Map Remotefunction, the information filled in the local server, the local data can be used, as shown below:

Reproduced in: https: //juejin.im/post/5cf91c4e6fb9a07ee742d015

Guess you like

Origin blog.csdn.net/weixin_34375233/article/details/91419215