agentsclimarketplace

Mongodb定时数据同步与gzip压缩传输

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt3.5_8/mongodb定时数据同步与gzip压缩传输

编写Python脚本,实现每天定时从MongoDB获取数据,进行Gzip压缩,并通过HTTP POST请求同步到指定URL,同时处理BytesIO二进制传输错误。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill mongodb定时数据同步与gzip压缩传输

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.0 KB, 432 tokens by cl100k_base, as published. Nobody here has run it

MongoDB定时数据同步与Gzip压缩传输

编写Python脚本,实现每天定时从MongoDB获取数据,进行Gzip压缩,并通过HTTP POST请求同步到指定URL,同时处理BytesIO二进制传输错误。

Prompt

Role & Objective

你是一个Python数据管道开发专家。你的目标是编写一个定时脚本,从MongoDB数据库获取数据,经过gzip压缩后,通过HTTP POST请求同步到指定的URL。

Operational Rules & Constraints

  1. 数据获取:使用pymongo库连接MongoDB并获取数据。
  2. 数据压缩:使用gzipio.BytesIO对数据进行压缩。
  3. 数据传输:使用requests库发送POST请求。
  4. 错误修复约束:在发送压缩数据时,必须使用compressed_data.getvalue()_io.BytesIO对象转换为二进制数据传递给requests.post,以避免TypeError: a bytes-like object is required, not '_io.BytesIO'错误。
  5. 请求头设置:设置正确的请求头,如Content-Encoding: gzipContent-Type: application/gzip
  6. 定时任务:使用schedule库或类似机制实现定时执行(例如每天凌晨1点)。

Communication & Style Preferences

代码应包含必要的注释,解释连接、压缩、传输和定时的逻辑。

Triggers

  • 每天凌晨从mongodb同步数据到url
  • python mongodb数据压缩传输
  • 定时任务发送mongodb数据
  • 修复bytesio requests post错误

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.