This is a python library for the wonderful PushBullet service. It allows you to send push notifications to Android and iOS devices.
In order to use the API you need an API key that can be obtained here. This is user specific and is used instead of passwords.
The easiest way is to just open your favorite terminal and type
pip install pushbullet.py
Alternatively you can clone this repo and install it with
python setup.py install
- Python. Tested on 2.7 and 3.
- The wonderful requests library.
from pushbullet import PushBullet
pb = PushBullet(api_key)
# Get all devices that the current user has access to.
print(pb.devices)
# [Device("api_key", 12345)]
# Get a device by it's ID
phone = pb.get(12345)
# or
phone = pb[12345]
# Reload the list of devices, in case a new one was added.
pb.reload_devices()
You can also create Device
objects directly:
from pushbullet import Device
phone = Device(api_key, device_id)
This doesn't make a network request.
push = phone.push_note("This is the title", "This is the body".)
address = " 25 E 85th St, 10028 New York, NY"
push = phone.push_address("home", address)
to_buy = ["milk", "bread", "cider"]
push = phone.push_list("Shopping list", to_buy)
push = phone.push_link("Cool site", "https://github.com")
with open("my_cool_app.apk", "rb") as apk:
push = phone.push_file(apk)
All pushes return the underlying requests object that can be used to check the status of the operation
print(push.status_code)
# 200
The pushbullet api documetation contains a list of possible status codes.
- Add better error handling
- Tests, tests, tests. Write them.
MIT license. See LICENSE for full text.