simvue-io / simvue-io/python-api
Support sending gzipped request bodies
未关闭
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 4
- 派生
- 1
- 平均合并
- 5 天 8 小时
- 30 天内合并 PR
- 4
描述
Whenever there is a large amount of content the Python API should gzip the body and include the following header:
"Content-Encoding": "gzip"
This should be done for:
- Sending large numbers of runs, i.e. "loadSim"
- Sending scalar or non-scalar metrics
- Sending events
In the requests post you can just do:
data=gzip.compress(msgpack.packb(data, use_bin_type=True))
or
data=gzip.compress(json.dumps(data).encode("utf-8"))
as appropriate. Obviously don't use json=... any more in requests.post(...), use data=... instead.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 loadSim、标量和非标量指标以及事件的 Python API 请求路径入手,重点查看其中的 requests.post 调用以及当前的 JSON 或 msgpack payload。完成标准是:对于全部三个操作,适用的大型请求体使用带 gzip 压缩的 data=,并发送 Content-Encoding: gzip 标头。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- api
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100