(self, text_list: list)
| 81 | return text_list |
| 82 | |
| 83 | def send(self, text_list: list): |
| 84 | limiter = Limiter(Rate(20, Duration.MINUTE)) # 频率限制,20条/分钟 |
| 85 | for text in text_list: |
| 86 | with limiter.ratelimit('identity', delay=True): |
| 87 | print(f'{len(text)} {text[:50]}...{text[-50:]}') |
| 88 | |
| 89 | data = {"msgtype": "markdown", "markdown": {"content": text}} |
| 90 | headers = {'Content-Type': 'application/json'} |
| 91 | url = f'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={self.key}' |
| 92 | r = requests.post(url=url, headers=headers, data=json.dumps(data), proxies=self.proxy) |
| 93 | |
| 94 | if r.status_code == 200: |
| 95 | Color.print_success('[+] wecomBot 发送成功') |
| 96 | else: |
| 97 | Color.print_failed('[-] wecomBot 发送失败') |
| 98 | print(r.text) |
| 99 | |
| 100 | |
| 101 | class dingtalkBot: |
nothing calls this directly
no test coverage detected