| 192 | |
| 193 | # push推送 |
| 194 | def pushplus_bot(title, content): |
| 195 | try: |
| 196 | print("\n") |
| 197 | if not PUSH_PLUS_TOKEN: |
| 198 | print("PUSHPLUS服务的token未设置!!\n取消推送") |
| 199 | return |
| 200 | print("PUSHPLUS服务启动") |
| 201 | url = 'http://www.pushplus.plus/send' |
| 202 | data = { |
| 203 | "token": PUSH_PLUS_TOKEN, |
| 204 | "title": title, |
| 205 | "content": content |
| 206 | } |
| 207 | body = json.dumps(data).encode(encoding='utf-8') |
| 208 | headers = {'Content-Type': 'application/json'} |
| 209 | response = requests.post(url=url, data=body, headers=headers).json() |
| 210 | if response['code'] == 200: |
| 211 | print('推送成功!') |
| 212 | else: |
| 213 | print('推送失败!') |
| 214 | except Exception as e: |
| 215 | print(e) |
| 216 | |
| 217 | # 微信机器人 |
| 218 | def wxBot(title, content): |