Storyscript平台的HTTP网关
story-http的Python项目详细描述
Storyscript HTTP网关
API网关服务器,用于通过HTTP执行故事。在
httpserverasserverwhenserverlistenmethod:'get'path:'/'asrloginfomsg:r.bodyloginfomsg:r.headersloginfomsg:r.headers['Host']rwritedata:'Hello World'rstatuscode:200rfinish^{pr2}$
发展
设置虚拟环境并安装依赖项
virtualenv -p python3.6 venv
source venv/bin/activate
pip install -r requirements.txt
您可能需要告诉pycurl openssl安装的路径
pip install --install-option="--with-openssl" --install-option="--openssl-dir=/usr/local/opt/openssl" pycurl
见https://github.com/nahamsec/JSParser/issues/22
通过调用本地运行
python -m app.main --logging=debug --debug
注册端点
curl --data '{"endpoint": "http://localhost:9000/story/foo", "data":{"path":"/ping", "method": "post", "host": "a"}}'\ -H "Content-Type: application/json"\ localhost:8889/register
现在访问该端点
curl -X POST -d 'foobar' -H "Host: a.storyscriptapp.com" http://localhost:8888/ping
注销终结点
curl --data '{"endpoint": "http://localhost:9000/story/foo", "data":{"path":"/ping", "method": "post", "host": "a"}}'\ -H "Content-Type: application/json"\ localhost:8889/unregister
- 项目
标签: