mirror of
https://github.com/hex-ci/smzdm_script.git
synced 2026-11-05 15:07:46 +08:00
Add smzdm_bot
This commit is contained in:
25
notifications/pushplus.py
Normal file
25
notifications/pushplus.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import json
|
||||
import requests
|
||||
import os
|
||||
|
||||
|
||||
def pushplus(title, content, token, template='html'):
|
||||
url = 'https://www.pushplus.plus/send'
|
||||
body = {
|
||||
'token': token,
|
||||
'title': title,
|
||||
'content': content,
|
||||
'template': template
|
||||
}
|
||||
data = json.dumps(body).encode(encoding='utf-8')
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
rsp = requests.post(url, data=data, headers=headers)
|
||||
return rsp.json()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
token = os.environ.get('PUSH_PLUS_TOKEN')
|
||||
res = pushplus(title='Title',
|
||||
content='Content',
|
||||
token=token)
|
||||
print(res)
|
||||
17
notifications/serverchan.py
Normal file
17
notifications/serverchan.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import requests
|
||||
import os
|
||||
|
||||
|
||||
def serverchan(text, desp, secretKey):
|
||||
url = f'http://sc.ftqq.com/{secretKey}.send'
|
||||
session = requests.Session()
|
||||
data = {'text': text, 'desp': desp}
|
||||
resp = session.post(url, data=data)
|
||||
return resp.json()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
token = os.environ.get('PUSH_PLUS_TOKEN')
|
||||
resp = serverchan(text='test', desp='hi',
|
||||
secretKey=token)
|
||||
print(resp)
|
||||
Reference in New Issue
Block a user