Add smzdm_bot

This commit is contained in:
LuckyHunter
2022-10-17 00:19:48 +08:00
parent 0103d254f1
commit 3106e84055
7 changed files with 182 additions and 2 deletions

25
notifications/pushplus.py Normal file
View 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)

View 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)