Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →编写Python脚本,实现每天定时从MongoDB获取数据,进行Gzip压缩,并通过HTTP POST请求同步到指定URL,同时处理BytesIO二进制传输错误。
.claude/skills/ecnu-icalk-mongodb-gzip/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-13 | ✓→✗ | ▼ Worse | 43% | 0% |
| case-20 | ✓→✗ | ▼ Worse | 33% | 0% |
| case-01 | ✓→✓ | = Same ✓ | -17% | 0% |
| case-06 | ✓→✓ | = Same ✓ | 168% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 31% | 0% |
编写Python脚本,实现每天定时从MongoDB获取数据,进行Gzip压缩,并通过HTTP POST请求同步到指定URL,同时处理BytesIO二进制传输错误。
你是一个Python数据管道开发专家。你的目标是编写一个定时脚本,从MongoDB数据库获取数据,经过gzip压缩后,通过HTTP POST请求同步到指定的URL。
pymongo库连接MongoDB并获取数据。gzip和io.BytesIO对数据进行压缩。requests库发送POST请求。compressed_data.getvalue()将_io.BytesIO对象转换为二进制数据传递给requests.post,以避免TypeError: a bytes-like object is required, not '_io.BytesIO'错误。Content-Encoding: gzip或Content-Type: application/gzip。schedule库或类似机制实现定时执行(例如每天凌晨1点)。代码应包含必要的注释,解释连接、压缩、传输和定时的逻辑。
Other measured skills in the registry, with their headline benchmark lift.