Skip to content

Commit c6e51f9

Browse files
committed
feat: add pushplus,showdoc,xizhi
1 parent 06f351d commit c6e51f9

File tree

17 files changed

+330
-38
lines changed

17 files changed

+330
-38
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ipush
22

3-
APP 推送通知。支持往 **钉钉群、飞书群、Lark 群、Bark、Chanify、PushDeer** 推送消息。
3+
APP 推送通知。支持往 **钉钉群、飞书群、Lark 群、Bark、Chanify、PushDeer、PushPlus、Showdoc、息知** 推送消息。
44

55
## 使用说明
66

@@ -31,14 +31,18 @@ notify.send("ipush test")
3131
|**** | **Bark** | [https://day.app/2021/06/barkfaq/](https://day.app/2021/06/barkfaq/) | - | 仅支持 `iOS` |
3232
|| **Chanify** | [https://www.chanify.net/](https://www.chanify.net/) | - | 仅支持 `iOS` |
3333
|| **PushDeer** | https://www.pushdeer.com/ | - | |
34+
| // | // | **基于微信公众号** | \\\\ | \\\\ |
35+
|| **PushPlus** | [https://www.pushplus.plus/](https://www.pushplus.plus/doc) | - | |
36+
|| **Showdoc** | [https://push.showdoc.com.cn/](https://www.showdoc.com.cn/push) | - | |
37+
|| **息知** | [https://xz.qqoq.net/](https://xz.qqoq.net/) | - | |
3438

3539
## 开发
3640

37-
### 前置环境
41+
### 1. 前置开发环境
3842

3943
1. 使用 [**Rye**](https://rye-up.com/) 作为包管理工具
4044

41-
### 开发
45+
### 2. 开发流程
4246

4347
1. 安装依赖包:
4448

docs/README.md

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22

33
## 使用
44

5-
1. **钉钉群**
5+
### 1. 安装
6+
7+
```python
8+
pip install ipush
9+
```
10+
11+
### 2. 代码示例
12+
13+
- **钉钉群**
614

715
```python
816
from ipush.notify.dingtalk import Dingtalk
@@ -11,7 +19,7 @@ notify = Dingtalk("token", "secret")
1119
notify.send("ipush test")
1220
```
1321

14-
2. **飞书群**
22+
- **飞书群**
1523

1624
```python
1725
from ipush.notify.feishu import Feishu
@@ -20,7 +28,7 @@ notify = Feishu("token", "secret")
2028
notify.send("ipush test")
2129
```
2230

23-
3. **Lark 群**
31+
- **Lark 群**
2432

2533
```python
2634
from ipush.notify.lark import Lark
@@ -29,18 +37,18 @@ notify = Lark("token", "secret")
2937
notify.send("ipush test")
3038
```
3139

32-
4. **Bark**
40+
- **Bark**
3341

3442
```python
3543
from ipush.notify.bark import Bark
3644

3745
notify = Bark("token")
38-
notify.send("ipush test")
46+
notify.send("ipush test", "title")
3947
notify.seturl("https://self-hosted")
4048
notify.send("ipush test custom url")
4149
```
4250

43-
5. **Chanify**
51+
- **Chanify**
4452

4553
```python
4654
from ipush.notify.chanify import Chanify
@@ -51,7 +59,7 @@ notify.seturl("https://self-hosted")
5159
notify.send("ipush test custom url")
5260
```
5361

54-
6. **PushDeer**
62+
- **PushDeer**
5563

5664
```python
5765
from ipush.notify.pushdeer import PushDeer
@@ -61,3 +69,30 @@ notify.send("ipush test")
6169
notify.seturl("https://self-hosted")
6270
notify.send("ipush test custom url")
6371
```
72+
73+
- **PushPlus**
74+
75+
```python
76+
from ipush.notify.pushplus import PushPlus
77+
78+
notify = PushPlus("token")
79+
notify.send("ipush test", "title")
80+
```
81+
82+
- **Showdoc**
83+
84+
```python
85+
from ipush.notify.showdoc import Showdoc
86+
87+
notify = Showdoc("token")
88+
notify.send("ipush test", "title")
89+
```
90+
91+
- **Xizhi**
92+
93+
```python
94+
from ipush.notify.xizhi import Xizhi
95+
96+
notify = Xizhi("token")
97+
notify.send("ipush test", "title")
98+
```

pyproject.toml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "ipush"
3-
version = "0.2.0"
4-
description = "Push for python"
3+
version = "0.3.0"
4+
description = "APP 推送通知。支持往 钉钉群、飞书群、Lark 群、Bark、Chanify、PushDeer、PushPlus、Showdoc、息知 推送消息。"
55
authors = [
66
{ name = "Jetsung Chan", email = "[email protected]" }
77
]
@@ -10,27 +10,34 @@ dependencies = [
1010
"lxml>=4.9.4",
1111
]
1212
readme = "README.md"
13+
license ={ file = "LICENSE" }
14+
keywords = ["push", "notify", "dingtalk", "feishu", "lark", "bark", "chanify", "pushdeer", "pushplus", "showdoc", "xizhi"]
1315
requires-python = ">= 3.8"
1416
classifiers = [
1517
'Development Status :: 4 - Beta',
1618
'Environment :: Console',
19+
'Environment :: Web Environment',
1720
'Intended Audience :: Developers',
1821
'License :: OSI Approved :: Apache Software License',
1922
'Natural Language :: Chinese (Simplified)',
2023
'Operating System :: OS Independent',
2124
'Programming Language :: Python',
25+
'Programming Language :: Python :: 3',
26+
'Programming Language :: Python :: 3.8',
2227
'Programming Language :: Python :: 3.8',
2328
'Programming Language :: Python :: 3.9',
2429
'Programming Language :: Python :: 3.10',
2530
'Programming Language :: Python :: 3.11',
2631
'Programming Language :: Python :: 3.12',
27-
'Programming Language :: Python :: 3.13',
32+
'Programming Language :: Python :: 3 :: Only',
33+
'Programming Language :: Python :: Implementation :: CPython',
2834
'Topic :: Communications :: Email',
35+
'Topic :: Software Development :: Libraries',
2936
]
3037
[project.urls]
3138
Homepage = "https://git.jetsung.com/idev/pypush"
32-
Documentation = "https://framagit.org/idev/pypush"
33-
Repository = "https://framagit.org/idev/pypush.git"
39+
Documentation = "https://pypush.skiy.net/"
40+
Repository = "https://github.com/idevsig/pypush"
3441

3542
[build-system]
3643
requires = ["hatchling"]

src/ipush/notify/bark.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ def __init__(self, token=''):
1313
self.token = token
1414
self.url = 'https://api.day.app'
1515

16-
def signature(self):
16+
def _signature(self):
1717
pass
1818

1919
def seturl(self, url):
2020
self.url = url
2121

22-
def requrl(self):
22+
def _geturl(self):
2323
"""
2424
生成请求的 URL
2525
"""
2626
return f'{self.url}/push'
2727

28-
def send(self, message):
28+
def send(self, message, title=''):
2929
"""
3030
发送通知
3131
:param message: 消息内容
3232
"""
33-
req_url = self.requrl()
33+
req_url = self._geturl()
3434

3535
headers = {
3636
'content-type': 'application/json',
@@ -39,6 +39,7 @@ def send(self, message):
3939
req.update_headers(headers)
4040

4141
data = {
42+
'title': '' if title == '' else title,
4243
'body': message,
4344
'device_key': self.token,
4445
}

src/ipush/notify/chanify.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ def __init__(self, token=''):
1313
self.token = token
1414
self.url = 'https://api.chanify.net'
1515

16-
def signature(self):
16+
def _signature(self):
1717
pass
1818

1919
def seturl(self, url):
2020
self.url = url
2121

22-
def requrl(self):
22+
def _geturl(self):
2323
"""
2424
生成请求的 URL
2525
"""
@@ -30,7 +30,7 @@ def send(self, message):
3030
发送通知
3131
:param message: 消息内容
3232
"""
33-
req_url = self.requrl()
33+
req_url = self._geturl()
3434

3535
headers = {
3636
'content-type': 'application/json',

src/ipush/notify/dingtalk.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def __init__(self, token='', secret=''):
1515
self.token = token
1616
self.secret = secret
1717

18-
def signature(self):
18+
def _signature(self):
1919
"""
2020
签名
2121
"""
@@ -25,7 +25,7 @@ def signature(self):
2525
'' if self.secret == '' else signature(self.secret, timestamp, 0),
2626
)
2727

28-
def requrl(self, sign):
28+
def _geturl(self, sign):
2929
"""
3030
生成请求的 URL
3131
:param sign: 签名
@@ -37,8 +37,8 @@ def send(self, message):
3737
发送通知
3838
:param message: 消息内容
3939
"""
40-
timestamp, sign = self.signature()
41-
req_url = self.requrl(
40+
timestamp, sign = self._signature()
41+
req_url = self._geturl(
4242
'' if self.secret == '' else f'&timestamp={timestamp}&sign={sign}'
4343
)
4444

src/ipush/notify/feishu.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def __init__(self, token='', secret=''):
1515
self.token = token
1616
self.secret = secret
1717

18-
def signature(self):
18+
def _signature(self):
1919
"""
2020
签名
2121
"""
@@ -25,7 +25,7 @@ def signature(self):
2525
'' if self.secret == '' else signature(self.secret, timestamp, 1),
2626
)
2727

28-
def requrl(self):
28+
def _geturl(self):
2929
"""
3030
生成请求的 URL
3131
"""
@@ -36,8 +36,8 @@ def send(self, message):
3636
发送通知
3737
:param message: 消息内容
3838
"""
39-
timestamp, sign = self.signature()
40-
req_url = self.requrl()
39+
timestamp, sign = self._signature()
40+
req_url = self._geturl()
4141

4242
headers = {
4343
'content-type': 'application/json',

src/ipush/notify/lark.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def __init__(self, token='', secret=''):
1515
self.token = token
1616
self.secret = secret
1717

18-
def signature(self):
18+
def _signature(self):
1919
"""
2020
签名
2121
"""
@@ -25,7 +25,7 @@ def signature(self):
2525
'' if self.secret == '' else signature(self.secret, timestamp, 1),
2626
)
2727

28-
def requrl(self):
28+
def _geturl(self):
2929
"""
3030
生成请求的 URL
3131
"""
@@ -36,8 +36,8 @@ def send(self, message):
3636
发送通知
3737
:param message: 消息内容
3838
"""
39-
timestamp, sign = self.signature()
40-
req_url = self.requrl()
39+
timestamp, sign = self._signature()
40+
req_url = self._geturl()
4141

4242
headers = {
4343
'content-type': 'application/json',

src/ipush/notify/notify.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class Notify(ABC):
1010
@abstractmethod
11-
def signature(self):
11+
def _signature(self):
1212
"""
1313
签名
1414
"""

src/ipush/notify/pushdeer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ def __init__(self, token=''):
1313
self.token = token
1414
self.url = 'https://api2.pushdeer.com'
1515

16-
def signature(self):
16+
def _signature(self):
1717
pass
1818

1919
def seturl(self, url):
2020
self.url = url
2121

22-
def requrl(self):
22+
def _geturl(self):
2323
"""
2424
生成请求的 URL
2525
"""
@@ -30,7 +30,7 @@ def send(self, message):
3030
发送通知
3131
:param message: 消息内容
3232
"""
33-
req_url = self.requrl()
33+
req_url = self._geturl()
3434

3535
headers = {
3636
'content-type': 'application/json',

0 commit comments

Comments
 (0)