push-tools 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- push_tools-0.0.1/LICENSE +21 -0
- push_tools-0.0.1/PKG-INFO +75 -0
- push_tools-0.0.1/README.md +61 -0
- push_tools-0.0.1/push_tools/__init__.py +45 -0
- push_tools-0.0.1/push_tools/err.py +15 -0
- push_tools-0.0.1/push_tools/push.py +19 -0
- push_tools-0.0.1/push_tools/pushplus.py +44 -0
- push_tools-0.0.1/push_tools/qmsg.py +28 -0
- push_tools-0.0.1/push_tools/server.py +28 -0
- push_tools-0.0.1/push_tools/wechat.py +124 -0
- push_tools-0.0.1/push_tools.egg-info/PKG-INFO +75 -0
- push_tools-0.0.1/push_tools.egg-info/SOURCES.txt +15 -0
- push_tools-0.0.1/push_tools.egg-info/dependency_links.txt +1 -0
- push_tools-0.0.1/push_tools.egg-info/requires.txt +1 -0
- push_tools-0.0.1/push_tools.egg-info/top_level.txt +1 -0
- push_tools-0.0.1/setup.cfg +4 -0
- push_tools-0.0.1/setup.py +18 -0
push_tools-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 __SCRIPT__
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: push-tools
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A tool supports push message.
|
|
5
|
+
Home-page: https://github.com/arcturus-script/push-tools
|
|
6
|
+
Author: ARCTURUS
|
|
7
|
+
Author-email: ice99125@qq.com
|
|
8
|
+
License: MIT Licence
|
|
9
|
+
Keywords: qmsg,pushplus,server,wechat
|
|
10
|
+
Platform: any
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: requests
|
|
14
|
+
|
|
15
|
+
# push-tools
|
|
16
|
+
|
|
17
|
+
A repository for message push (๑•̀ㅂ•́)و✧
|
|
18
|
+
|
|
19
|
+
## usage
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from push_tools import pushplus
|
|
23
|
+
|
|
24
|
+
p = pushplus("069ac...")
|
|
25
|
+
p.send("hello world.", title="test")
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from push_tools import qmsg
|
|
30
|
+
|
|
31
|
+
q = qmsg("5004...")
|
|
32
|
+
q.send("hello world.")
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from push_tools import server
|
|
37
|
+
|
|
38
|
+
s = server("SCT8...")
|
|
39
|
+
s.send("###title\nhello world.", title="title")
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from push_tools import workWechat
|
|
44
|
+
|
|
45
|
+
w = workWechat({
|
|
46
|
+
"corpSecret": "slFn...",
|
|
47
|
+
"corpid": "ww9f...",
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
w.send("###title3\nhello world.", msgtype="markdown")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from push_tools import workWechatRobot
|
|
55
|
+
|
|
56
|
+
robot = workWechatRobot("ea3f7ac4..")
|
|
57
|
+
robot.send("###title3\nhello world.", msgtype="markdown")
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from push import push_composite, pushplus, qmsg
|
|
62
|
+
|
|
63
|
+
p = PushComposite()
|
|
64
|
+
p.add("pushplus", pushplus("069ac..."))
|
|
65
|
+
p.add("qmsg", qmsg("5004..."))
|
|
66
|
+
|
|
67
|
+
p.send("title\nhello world.", title="title")
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from push import push_creator
|
|
72
|
+
|
|
73
|
+
p = push_creator("qmsg", "2130...")
|
|
74
|
+
p.send("hello world")
|
|
75
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# push-tools
|
|
2
|
+
|
|
3
|
+
A repository for message push (๑•̀ㅂ•́)و✧
|
|
4
|
+
|
|
5
|
+
## usage
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from push_tools import pushplus
|
|
9
|
+
|
|
10
|
+
p = pushplus("069ac...")
|
|
11
|
+
p.send("hello world.", title="test")
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
from push_tools import qmsg
|
|
16
|
+
|
|
17
|
+
q = qmsg("5004...")
|
|
18
|
+
q.send("hello world.")
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from push_tools import server
|
|
23
|
+
|
|
24
|
+
s = server("SCT8...")
|
|
25
|
+
s.send("###title\nhello world.", title="title")
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from push_tools import workWechat
|
|
30
|
+
|
|
31
|
+
w = workWechat({
|
|
32
|
+
"corpSecret": "slFn...",
|
|
33
|
+
"corpid": "ww9f...",
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
w.send("###title3\nhello world.", msgtype="markdown")
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from push_tools import workWechatRobot
|
|
41
|
+
|
|
42
|
+
robot = workWechatRobot("ea3f7ac4..")
|
|
43
|
+
robot.send("###title3\nhello world.", msgtype="markdown")
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from push import push_composite, pushplus, qmsg
|
|
48
|
+
|
|
49
|
+
p = PushComposite()
|
|
50
|
+
p.add("pushplus", pushplus("069ac..."))
|
|
51
|
+
p.add("qmsg", qmsg("5004..."))
|
|
52
|
+
|
|
53
|
+
p.send("title\nhello world.", title="title")
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from push import push_creator
|
|
58
|
+
|
|
59
|
+
p = push_creator("qmsg", "2130...")
|
|
60
|
+
p.send("hello world")
|
|
61
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from .pushplus import pushplus
|
|
2
|
+
from .qmsg import qmsg
|
|
3
|
+
from .server import server
|
|
4
|
+
from .wechat import workWechat, workWechatRobot
|
|
5
|
+
|
|
6
|
+
push_server = {
|
|
7
|
+
"pushplus": pushplus,
|
|
8
|
+
"server": server,
|
|
9
|
+
"qmsg": qmsg,
|
|
10
|
+
"workWechatRobot": workWechatRobot,
|
|
11
|
+
"workWechat": workWechat,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class push_composite:
|
|
16
|
+
def __init__(self):
|
|
17
|
+
self.children = {}
|
|
18
|
+
|
|
19
|
+
def add(self, key, push):
|
|
20
|
+
self.children[key] = push
|
|
21
|
+
|
|
22
|
+
def send(self, msg, **kwargs):
|
|
23
|
+
for push in self.children.values():
|
|
24
|
+
push.send(msg, **kwargs)
|
|
25
|
+
|
|
26
|
+
def remove(self, key):
|
|
27
|
+
self.children.pop(key)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class push_creator:
|
|
31
|
+
def __init__(self, type, key):
|
|
32
|
+
self.push = self.create(type, key)
|
|
33
|
+
|
|
34
|
+
def create(self, type, key):
|
|
35
|
+
if type not in push_server:
|
|
36
|
+
print(f"Unsupported push type: {type}")
|
|
37
|
+
return None
|
|
38
|
+
|
|
39
|
+
return push_server[type](key)
|
|
40
|
+
|
|
41
|
+
def send(self, msg, **kwargs):
|
|
42
|
+
if self.push is not None:
|
|
43
|
+
self.push.send(msg, **kwargs)
|
|
44
|
+
else:
|
|
45
|
+
print("No push instance created.")
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
def catch_exception(func):
|
|
2
|
+
def wrapper(*args, **kwargs):
|
|
3
|
+
try:
|
|
4
|
+
return func(*args, **kwargs)
|
|
5
|
+
except Exception as e:
|
|
6
|
+
name = args[0].__class__.__name__
|
|
7
|
+
err_type = type(e).__name__
|
|
8
|
+
|
|
9
|
+
print(f"[{name}] An error occurred, because > {err_type}: {e}")
|
|
10
|
+
|
|
11
|
+
return wrapper
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class AccessFailed(Exception):
|
|
15
|
+
pass
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class push(ABC):
|
|
5
|
+
def __init__(self, key):
|
|
6
|
+
super().__init__()
|
|
7
|
+
self.key = key
|
|
8
|
+
|
|
9
|
+
@abstractmethod
|
|
10
|
+
def send(self, msg, **kwargs):
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
def success(self, *args):
|
|
14
|
+
name = self.__class__.__name__
|
|
15
|
+
|
|
16
|
+
if args:
|
|
17
|
+
print(f"[{name}]", *args)
|
|
18
|
+
else:
|
|
19
|
+
print(f"[{name}] Operate successfully.")
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from .err import catch_exception, AccessFailed
|
|
2
|
+
from .push import push
|
|
3
|
+
import requests as re
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# https://www.pushplus.plus
|
|
7
|
+
class pushplus(push):
|
|
8
|
+
# 请求地址
|
|
9
|
+
url = "http://www.pushplus.plus/send"
|
|
10
|
+
|
|
11
|
+
def __init__(self, key):
|
|
12
|
+
super().__init__(key)
|
|
13
|
+
|
|
14
|
+
# 消息接口
|
|
15
|
+
@catch_exception
|
|
16
|
+
def send(self, msg, **kwargs):
|
|
17
|
+
params = {
|
|
18
|
+
"token": self.key,
|
|
19
|
+
"content": msg,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
# 请求参数
|
|
23
|
+
options = [
|
|
24
|
+
"title",
|
|
25
|
+
"topic",
|
|
26
|
+
"template",
|
|
27
|
+
"channel",
|
|
28
|
+
"webhook",
|
|
29
|
+
"callbackUrl",
|
|
30
|
+
"timestamp",
|
|
31
|
+
"to",
|
|
32
|
+
"pre",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
for key, value in kwargs.items():
|
|
36
|
+
if key in options:
|
|
37
|
+
params[key] = value
|
|
38
|
+
|
|
39
|
+
res = re.post(self.url, json=params).json()
|
|
40
|
+
|
|
41
|
+
if res.get("code") == 200:
|
|
42
|
+
self.success()
|
|
43
|
+
else:
|
|
44
|
+
raise AccessFailed(res.get("msg"))
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from .err import catch_exception, AccessFailed
|
|
2
|
+
from .push import push
|
|
3
|
+
import requests as re
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# https://qmsg.zendee.cn/
|
|
7
|
+
class qmsg(push):
|
|
8
|
+
url = "https://qmsg.zendee.cn"
|
|
9
|
+
|
|
10
|
+
def __init__(self, key):
|
|
11
|
+
super().__init__(key)
|
|
12
|
+
self.url = f"{qmsg.url}/send/{key}"
|
|
13
|
+
|
|
14
|
+
@catch_exception
|
|
15
|
+
def send(self, msg, **kwargs) -> None:
|
|
16
|
+
params = {"msg": msg}
|
|
17
|
+
options = ["qq", "bot"]
|
|
18
|
+
|
|
19
|
+
for k, v in kwargs.items():
|
|
20
|
+
if k in options:
|
|
21
|
+
params[k] = v
|
|
22
|
+
|
|
23
|
+
res = re.post(self.url, params=params).json()
|
|
24
|
+
|
|
25
|
+
if res.get("code") == 0:
|
|
26
|
+
self.success()
|
|
27
|
+
else:
|
|
28
|
+
raise AccessFailed(res.get("reason"))
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from .err import catch_exception, AccessFailed
|
|
2
|
+
from .push import push
|
|
3
|
+
import requests as re
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# https://sct.ftqq.com
|
|
7
|
+
class server(push):
|
|
8
|
+
url = "https://sctapi.ftqq.com"
|
|
9
|
+
|
|
10
|
+
def __init__(self, key):
|
|
11
|
+
super().__init__(key)
|
|
12
|
+
self.url = f"{server.url}/{self.key}.send"
|
|
13
|
+
|
|
14
|
+
@catch_exception
|
|
15
|
+
def send(self, msg, title, **kwargs):
|
|
16
|
+
params = {"title": title, "desp": msg}
|
|
17
|
+
options = ["short", "noip", "channel", "openid"]
|
|
18
|
+
|
|
19
|
+
for k, v in kwargs.items():
|
|
20
|
+
if k in options:
|
|
21
|
+
params[k] = v
|
|
22
|
+
|
|
23
|
+
res = re.post(self.url, params=params).json()
|
|
24
|
+
|
|
25
|
+
if res.get("code") == 0:
|
|
26
|
+
self.success()
|
|
27
|
+
else:
|
|
28
|
+
raise AccessFailed(res.get("info"))
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
from .err import catch_exception, AccessFailed
|
|
2
|
+
from .push import push
|
|
3
|
+
import requests as re
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# 内部应用开发文档 (https://developer.work.weixin.qq.com/document/path/90664)
|
|
7
|
+
# 相关参数获取方法 (https://developer.work.weixin.qq.com/document/path/90665)
|
|
8
|
+
class workWechat(push):
|
|
9
|
+
token = "https://qyapi.weixin.qq.com/cgi-bin/gettoken"
|
|
10
|
+
url = "https://qyapi.weixin.qq.com/cgi-bin/message/send"
|
|
11
|
+
|
|
12
|
+
def __init__(self, key):
|
|
13
|
+
super().__init__(key)
|
|
14
|
+
|
|
15
|
+
@catch_exception
|
|
16
|
+
def get_access_token(self):
|
|
17
|
+
corpSecret = self.key["corpSecret"]
|
|
18
|
+
corid = self.key["corpid"]
|
|
19
|
+
|
|
20
|
+
params = {"corpid": corid, "corpsecret": corpSecret}
|
|
21
|
+
|
|
22
|
+
res = re.get(self.token, params).json()
|
|
23
|
+
|
|
24
|
+
if res.get("errcode") == 0:
|
|
25
|
+
return res.get("access_token")
|
|
26
|
+
else:
|
|
27
|
+
raise AccessFailed(res.get("errmsg"))
|
|
28
|
+
|
|
29
|
+
# 文本消息
|
|
30
|
+
def send(self, msg, agentid, **kwargs):
|
|
31
|
+
msgtype = kwargs.get("msgtype", "text")
|
|
32
|
+
|
|
33
|
+
body = {"msgtype": msgtype, msgtype: {"content": msg}, "agentid": agentid}
|
|
34
|
+
|
|
35
|
+
options = {
|
|
36
|
+
"touser": "@all",
|
|
37
|
+
"toparty": "",
|
|
38
|
+
"totag": "",
|
|
39
|
+
"safe": 0,
|
|
40
|
+
"enable_id_trans": 0,
|
|
41
|
+
"enable_duplicate_check": 0,
|
|
42
|
+
"duplicate_check_interval": 1800,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
for k, v in options.items():
|
|
46
|
+
if k in kwargs:
|
|
47
|
+
body[k] = v
|
|
48
|
+
else:
|
|
49
|
+
body[k] = options[k]
|
|
50
|
+
|
|
51
|
+
self.raw_send(body)
|
|
52
|
+
|
|
53
|
+
@catch_exception
|
|
54
|
+
def raw_send(self, body):
|
|
55
|
+
params = {"access_token": self.get_access_token()}
|
|
56
|
+
|
|
57
|
+
res = re.post(self.url, params=params, json=body).json()
|
|
58
|
+
|
|
59
|
+
errcode = res.get("errcode")
|
|
60
|
+
|
|
61
|
+
if errcode == 0:
|
|
62
|
+
self.success()
|
|
63
|
+
else:
|
|
64
|
+
raise AccessFailed(res.get("errmsg"))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
# https://developer.work.weixin.qq.com/document/path/91770
|
|
68
|
+
class workWechatRobot(push):
|
|
69
|
+
url = "https://qyapi.weixin.qq.com/cgi-bin/webhook"
|
|
70
|
+
|
|
71
|
+
def __init__(self, key):
|
|
72
|
+
super().__init__(key)
|
|
73
|
+
self.surl = f"{workWechatRobot.url}/send"
|
|
74
|
+
self.uurl = f"{workWechatRobot.url}/upload_media"
|
|
75
|
+
|
|
76
|
+
def send(self, msg, **kwargs):
|
|
77
|
+
msgtype = kwargs.get("msgtype")
|
|
78
|
+
|
|
79
|
+
if msgtype == "markdown":
|
|
80
|
+
self._markdown(msg)
|
|
81
|
+
else:
|
|
82
|
+
self._text(msg, **kwargs)
|
|
83
|
+
|
|
84
|
+
@catch_exception
|
|
85
|
+
def raw_send(self, body):
|
|
86
|
+
res = re.post(self.surl, params={"key": self.key}, json=body).json()
|
|
87
|
+
|
|
88
|
+
errcode = res.get("errcode")
|
|
89
|
+
|
|
90
|
+
if errcode == 0:
|
|
91
|
+
self.success()
|
|
92
|
+
else:
|
|
93
|
+
raise AccessFailed(res.get("errmsg"))
|
|
94
|
+
|
|
95
|
+
def _text(self, content, **kwargs):
|
|
96
|
+
options = ["mentioned_list", "mentioned_mobile_list"]
|
|
97
|
+
body = {"content": content}
|
|
98
|
+
|
|
99
|
+
for k, v in kwargs.items():
|
|
100
|
+
if k in options:
|
|
101
|
+
body[k] = v
|
|
102
|
+
|
|
103
|
+
self.raw_send({"msgtype": "text", "text": body})
|
|
104
|
+
|
|
105
|
+
def _markdown(self, content):
|
|
106
|
+
self.raw_send({"msgtype": "markdown", "markdown": {"content": content}})
|
|
107
|
+
|
|
108
|
+
@catch_exception
|
|
109
|
+
def upload(self, type, file):
|
|
110
|
+
res = re.post(
|
|
111
|
+
self.uurl,
|
|
112
|
+
params={
|
|
113
|
+
"key": self.key,
|
|
114
|
+
"type": type,
|
|
115
|
+
},
|
|
116
|
+
files={"file": file},
|
|
117
|
+
).json()
|
|
118
|
+
|
|
119
|
+
errcode = res.get("errcode")
|
|
120
|
+
|
|
121
|
+
if errcode == 0:
|
|
122
|
+
return res.get("media_id")
|
|
123
|
+
else:
|
|
124
|
+
raise AccessFailed(res.get("errmsg"))
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: push-tools
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A tool supports push message.
|
|
5
|
+
Home-page: https://github.com/arcturus-script/push-tools
|
|
6
|
+
Author: ARCTURUS
|
|
7
|
+
Author-email: ice99125@qq.com
|
|
8
|
+
License: MIT Licence
|
|
9
|
+
Keywords: qmsg,pushplus,server,wechat
|
|
10
|
+
Platform: any
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: requests
|
|
14
|
+
|
|
15
|
+
# push-tools
|
|
16
|
+
|
|
17
|
+
A repository for message push (๑•̀ㅂ•́)و✧
|
|
18
|
+
|
|
19
|
+
## usage
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from push_tools import pushplus
|
|
23
|
+
|
|
24
|
+
p = pushplus("069ac...")
|
|
25
|
+
p.send("hello world.", title="test")
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from push_tools import qmsg
|
|
30
|
+
|
|
31
|
+
q = qmsg("5004...")
|
|
32
|
+
q.send("hello world.")
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from push_tools import server
|
|
37
|
+
|
|
38
|
+
s = server("SCT8...")
|
|
39
|
+
s.send("###title\nhello world.", title="title")
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from push_tools import workWechat
|
|
44
|
+
|
|
45
|
+
w = workWechat({
|
|
46
|
+
"corpSecret": "slFn...",
|
|
47
|
+
"corpid": "ww9f...",
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
w.send("###title3\nhello world.", msgtype="markdown")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from push_tools import workWechatRobot
|
|
55
|
+
|
|
56
|
+
robot = workWechatRobot("ea3f7ac4..")
|
|
57
|
+
robot.send("###title3\nhello world.", msgtype="markdown")
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from push import push_composite, pushplus, qmsg
|
|
62
|
+
|
|
63
|
+
p = PushComposite()
|
|
64
|
+
p.add("pushplus", pushplus("069ac..."))
|
|
65
|
+
p.add("qmsg", qmsg("5004..."))
|
|
66
|
+
|
|
67
|
+
p.send("title\nhello world.", title="title")
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from push import push_creator
|
|
72
|
+
|
|
73
|
+
p = push_creator("qmsg", "2130...")
|
|
74
|
+
p.send("hello world")
|
|
75
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
push_tools/__init__.py
|
|
5
|
+
push_tools/err.py
|
|
6
|
+
push_tools/push.py
|
|
7
|
+
push_tools/pushplus.py
|
|
8
|
+
push_tools/qmsg.py
|
|
9
|
+
push_tools/server.py
|
|
10
|
+
push_tools/wechat.py
|
|
11
|
+
push_tools.egg-info/PKG-INFO
|
|
12
|
+
push_tools.egg-info/SOURCES.txt
|
|
13
|
+
push_tools.egg-info/dependency_links.txt
|
|
14
|
+
push_tools.egg-info/requires.txt
|
|
15
|
+
push_tools.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
push_tools
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="push-tools",
|
|
5
|
+
version="0.0.1",
|
|
6
|
+
keywords=["qmsg", "pushplus", "server", "wechat"],
|
|
7
|
+
description="A tool supports push message.",
|
|
8
|
+
long_description=open("README.md", encoding="utf-8").read(),
|
|
9
|
+
long_description_content_type="text/markdown",
|
|
10
|
+
license="MIT Licence",
|
|
11
|
+
url="https://github.com/arcturus-script/push-tools",
|
|
12
|
+
author="ARCTURUS",
|
|
13
|
+
author_email="ice99125@qq.com",
|
|
14
|
+
packages=find_packages(),
|
|
15
|
+
include_package_data=True,
|
|
16
|
+
platforms="any",
|
|
17
|
+
install_requires=["requests"],
|
|
18
|
+
)
|