通过PushDeer 推送消息
(title: str, content: str)
| 340 | |
| 341 | |
| 342 | def pushdeer(title: str, content: str) -> None: |
| 343 | """ |
| 344 | 通过PushDeer 推送消息 |
| 345 | """ |
| 346 | if not push_config.get("DEER_KEY"): |
| 347 | return |
| 348 | print("PushDeer 服务启动") |
| 349 | data = { |
| 350 | "text": title, |
| 351 | "desp": content, |
| 352 | "type": "markdown", |
| 353 | "pushkey": push_config.get("DEER_KEY"), |
| 354 | } |
| 355 | url = "https://api2.pushdeer.com/message/push" |
| 356 | if push_config.get("DEER_URL"): |
| 357 | url = push_config.get("DEER_URL") |
| 358 | |
| 359 | response = requests.post(url, data=data).json() |
| 360 | |
| 361 | if len(response.get("content").get("result")) > 0: |
| 362 | print("PushDeer 推送成功!") |
| 363 | else: |
| 364 | print("PushDeer 推送失败!错误信息:", response) |
| 365 | |
| 366 | |
| 367 | def chat(title: str, content: str) -> None: |