【发布时间】:2015-04-09 11:38:00
【问题描述】:
我正在尝试使用换行符/换行符发送推送通知 但它不起作用。 当我添加 %0d 或 \n 它什么都不做。
在 bash 中,我只需将 -d 添加到我的 curl 命令即可。 pycurl 有类似的解决方案吗?
提前致谢
有什么建议吗?
import pycurl
text2 = "line%0dline2"
postData = '{"type":"note", "title":"Title", "body":"%s"}' %text2.encode("utf-8")
c = pycurl.Curl()
c.setopt(pycurl.WRITEFUNCTION, lambda x: None)
c.setopt(pycurl.URL, 'https://api.pushbullet.com/v2/pushes')
c.setopt(pycurl.HTTPHEADER, ['Content-Type: application/json'])
c.setopt(pycurl.USERPWD, "api")
c.setopt(pycurl.POST, 1)
c.setopt(pycurl.POSTFIELDS, postData)
c.perform()
【问题讨论】:
标签: python pycurl pushbullet