Skip to content

feat: 为sunrequests.py添加域名级请求频率限制功能(Doubao Seed Code 2.0)#106

Open
yinlushu-x wants to merge 2 commits intoSnowfall-in-June:mainfrom
yinlushu-x:main
Open

feat: 为sunrequests.py添加域名级请求频率限制功能(Doubao Seed Code 2.0)#106
yinlushu-x wants to merge 2 commits intoSnowfall-in-June:mainfrom
yinlushu-x:main

Conversation

@yinlushu-x
Copy link
Copy Markdown

本次提交实现了请求工具类的频率限制优化:

  1. 功能说明
  • 支持对不同域名设置每分钟请求次数限制
  • 默认限制:每分钟 30 次请求
  • 自动按分钟重置请求计数
  • 超限后自动等待到下一分钟再执行
  1. 实现特点
  • 线程安全,使用锁保证多线程环境下计数准确
  • 非侵入式修改,不影响原有请求逻辑
  • 支持通过 set_rate_limit() 自定义域名限制
  1. 使用方式
    sun_requests.set_rate_limit("xxx.com", 10)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants