Welcome to your attention 『 I found you far away 』 Blog , Ongoing update
Welcome to your attention 『 I found you far away 』 Blog , Ongoing update
http://www.pushplus.plus/push1.html
You can scan the wechat code and log in to get token
# @Time : 2022/6/20 8:36
# @Author : Nanli
# @FileName: push Push wechat reminder .py
# encoding:utf-8
import requests
import json
import time
token = ' Yours token' # stay pushpush You can find it on the website
title= ' Data exception warning reminder ' # Change to the title you want
error_time=time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))# Get the formatted time
error_dataType=' Gateway data '
error_number=404
# Pay attention , The content below is because json Why , Note the key value pairs '' Symbol
# Format of the first character splicing type
#content ="{' Exception data type ':' Gateway data ',' Time of exception ':'"+str(error_time)+"',' Exception error code ':'404'}" # Change to the text you want
# The second kind ( recommend ) practical format Formatting
content ="{"+"' Exception data type ':'{}',' Time of exception ':'{}',' Exception error code ':'{}'".format(error_dataType,str(error_time),error_number)+"}" # Change to the text you want
url = 'http://www.pushplus.plus/send'
data = {
"token":token,# secret key
"title":title,# title
"content":content,# The content of the message sent , Here we are json Array
"template":"json"# The data type is json
}
body=json.dumps(data).encode(encoding='utf-8')
headers = {
'Content-Type':'application/json'}
request_result=requests.post(url,data=body,headers=headers)
print(request_result)# <Response [200]>
# The interface return code is described as follows :
#
# Return code explain
# 200 Successful implementation
# 302 Not logged in
# 401 Request not authorized
# 403 request IP unauthorized
# 500 System exception , Please try again later
# 600 Data exception , operation failed
# 805 No permission to view
# 888 Not enough points , Recharge required
# 900 User account usage is restricted
# 999 Server verification error
This section is from http://www.pushplus.plus/doc/guide/api.html# One 、 Send message interface
If you like , Give me one , Pay attention to ! Let's share more ways for computer majors to study !
Copyright notice :
I found you far away @mzh Original works , Reprint must be marked with the original link
Copyright 2022 mzh
Crated:2022-2-1
Welcome to your attention 『 I found you far away 』 Blog , Ongoing update
Welcome to your attention 『 I found you far away 』 Blog , Ongoing update