首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Pushover脚本未获得所需的结果

Pushover脚本未获得所需的结果
EN

Stack Overflow用户
提问于 2019-02-09 20:57:09
回答 1查看 92关注 0票数 0

按照pushover API的教程,我被卡住了。没有抛出错误,但没有收到推送通知。这将是智能门铃项目的一部分:

代码语言:javascript
复制
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代码块,但现在卡住了,任何帮助都会得到很大的帮助。

EN

回答 1

Stack Overflow用户

发布于 2019-02-09 22:15:58

您正在获取响应,但没有对其执行任何操作。把它打印出来,它可能会给你一些线索。

print(conn.getresponse())

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54606426

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档