No project description provided
Project description
ynm3k取名自”要你命3000”,目前的功能包括
一个通过完全通过json进行配置的mock调试/反向代理服务器
一个静态文件服务器
安装方法
通过pip安装
sudo pip install ynm3k
基本的使用方法
在8080启动一个mock服务器,根据mock.json的规则进行转发和改写请求
y3k --mock mock.json --port 8080
mock.json的一些例子如下所示:
根据前缀转发请求至不同服务器
[ ["/api/", "http://example.com/api/"], ["/static/my_work.html", "http://127.0.0.1/static/my_work.html"], ["/", "http://192.168.1.10:8080/"] ]
为每个请求增加一个特殊的header,比如设置X-Forwarded-For
[ [{"type": "prefix", "path": "/", "headers": {"X-Forwarded-For": "1.2.3.4"}}, {"type": "remote", "url": "https://ifcfg.cn/"} ] ]
改写特殊的请求(POST /test这个请求的结果从文件test.json中返回)
[ [ { "type": "exact", "path": "/test", "method": "POST" }, { "type": "file", "body": "test.json", "headers": {"content-type": "json"} } ], ["/", "http://192.168.1.10:8080/"] ]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ynm3k-0.2.1.tar.gz
(51.7 kB
view hashes)
Built Distribution
ynm3k-0.2.1-py2.py3-none-any.whl
(55.5 kB
view hashes)
Close
Hashes for ynm3k-0.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 659071ce163358c7e0fe13056492cefa3620df58fd97421f9839e10cf7d38256 |
|
MD5 | 15156753a2bcee0792465600f0a5313e |
|
BLAKE2b-256 | 8f5f0550890771cbfbf67806c872c66c806b85d635ea99343bbcd44a44d47371 |