首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >使用Python通过PushBullet向安卓发送通知

使用Python通过PushBullet向安卓发送通知
EN

Stack Overflow用户
提问于 2014-05-24 22:07:19
回答 1查看 9.7K关注 0票数 1

索夫

我在reddit上看到了一个关于在Pushbullet中使用Python的帖子,我想这会很方便,所以我尝试使用Python通过PushBullet发送通知,但是我遇到了几个问题

1)找不到每个ID对应的设备...

2)由于AttributeError: 'NoneType' object has no attribute 'push_note'错误,我无法向任何设备推送任何内容

PushBullet.py = https://pypi.python.org/pypi/pushbullet.py/0.4.1

Github项目:https://github.com/randomchars/pushbullet.py

运行以下代码:

from pushbullet import PushBullet

pb = PushBullet("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890")
print pb.devices

phone = pb.get("1234567890")
print phone

push = phone.push_note("This is the title", "This is the body")
print(push.status_code)

返回:

[Device('ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890', 1234567890), Device('ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890', 0000000000), Device('ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890', 1111111111), Device('ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890', 2222222222)]
None

Traceback (most recent call last):
  File "C:\Users\Admin\Desktop\PushBullet_Test.py", line 9, in <module>
    push = phone.push_note("This is the title", "This is the body")
AttributeError: 'NoneType' object has no attribute 'push_note'

请注意,他们的文档在push_note示例中有一个语法错误,它不应该在结束括号之前有一个句号/句号。

我在任何地方都找不到任何解决这个问题的方法,甚至找不到有这个问题的人:

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

https://stackoverflow.com/questions/23845936

复制
相关文章

相似问题

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