Pushplus 推送加 Python 运用实例

官网地址:https://www.pushplus.plus/

直接利用HTTP请求即可

import…

from ast import Str
from nturl2path import url2pathname
from re import template
from socket import herror
from tkinter.ttk import Style
import requests

一对多信息推送

def pushplus_send(title,content,topics):
    token ='7b0deafb89cd48909391be**********'
    title= title 
    content = content
    topics = topics
    template = "html"
    server_url = f'http://www.pushplus.plus/send?token={token}&title={title}&content={content}&template={template}&topic={topics}'.format(token,title,content,template,topics)
    print(server_url)
    requests.post(server_url)
if __name__ == '__main__':
    pushplus_send("title","content","topic")

指定信息(好友消息)推送

def server_send(title, content, to):
    token = '7b0deafb89cd44**************'
    title = title  
    content = content  
    to = to
    template = "html"
    server_url = f'http://www.pushplus.plus/send?token={token}&title={title}&content={content}&template={template}&to={to}'.format(
        token, title, content, template, to)
    print(server_url)
    requests.post(server_url)

if __name__ == '__main__':
    server_send("title", "content", "to")

一对一信息推送

def server_send(title, content, template):
    token = '7b0deafb89cd4890***********'
    title = title
    content = content
    template = template # txt/htm/json/markdown
    server_url = f'http://www.pushplus.plus/send?token={token}&title={title}&content={content}&template={template}'.format(
        token, title, content, template)
    print(server_url)
    requests.post(server_url)

if __name__ == '__main__':
    server_send("title, "content", "txt")
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值