【发布时间】:2019-07-03 12:33:00
【问题描述】:
按照 pushover API 的教程,我被困住了。没有错误被抛出,但没有收到推送项目符号通知。这将成为智能门铃项目的一部分:
import http.client
import urllib.request, urllib.parse, urllib.error
import json
def pushOver(title,message,url):
app_key = " app key "
user_key = " user key "
# connect with the pushover API Server
conn = http.client.HTTPSConnection("api.pushover.net:443")
# send a POST request in urlencoded json
conn.request("POST", "/1/message.json",
urllib.parse.urlencode({
"token": app_key,
"user": user_key,
"title": title,
"message": message,
"url": url,
}), { "content-type": "application/x-www-form-urlencoded" })
# any errors messages or other resonces?
conn.getresponse()
# app-specifict varables
pushOver('Doorbell', 'started', '')
print ("doorbell server started")
print ("Finished")
python 的新手已经将此代码转换为 python2 代码块,但现在卡住了,任何帮助都会得到很大的帮助。
【问题讨论】:
-
欢迎来到 StackOverflow!您能否更详细地描述您的问题:a)您的结果是什么? b) 您的期望结果是什么?
-
结果是脚本执行但不发送消息没有推送消息没有显示错误我真的难倒它在树莓派上不确定我是否提到过#
-
树莓派 3B Python 版本 3.5.3
标签: python raspberry-pi3 pushover