mirror of
https://github.com/hex-ci/smzdm_script.git
synced 2026-02-03 02:53:17 +08:00
26 lines
638 B
Python
26 lines
638 B
Python
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)
|