Skip to main content

A simple python client for

Project description

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

Alternatively you can clone this repo and install it with

python install


  • The wonderful requests library.
  • The magical python-magic library.



from pushbullet import Pushbullet

pb = Pushbullet(api_key)

If your key is invalid (that is, the Pushbullet API returns a 401), an InvalidKeyError is raised.

Pushing things

Pushing a text note

push = pb.push_note("This is the title", "This is the body")

push is a dictionary containing the data returned by the Pushbullet API.

Pushing an address

address = " 25 E 85th St, 10028 New York, NY"
push = pb.push_address("home", address)

Pushing a list

to_buy = ["milk", "bread", "cider"]
push = pb.push_list("Shopping list", to_buy)

Pushing a file

Pushing files is a two part process. First you need to upload the file, and after that you can push it like you would anything else.

with open("my_cool_picture.jpg", "rb") as pic:
    file_data = pb.upload_file(pic, "picture.jpg")

push = pb.push_file(**file_data)

upload_file returns a dictionary containing file_type, file_url and file_name keys. These are the same parameters that push_file take.

The advantage of this is that if you already have a file uploaded somewhere, you can use that instead of uploading again. For example:

push = pb.push_file(file_url="", file_name="cat.jpg", file_type="image/jpeg")

Working with pushes

You can also view all previous pushes:

pushes = pb.get_pushes()

Pushes is a list containing dictionaries that have push data. You can use this data to dismiss notifications or delete pushes.

latest = pushes[0]

# We already read it, so let's dismiss it

# Now delete it

Both of these raise PushbulletError if there’s an error.

You can also delete all of your pushes:

pushes = pb.delete_pushes()

Pushing to specific devices

So far all our pushes went to all connected devices, but there’s a way to limit that.

First we need to get hold of some devices.

# Get all devices that the current user has access to.
# [Device('Motorola Moto G'), Device('N7'), Device('Chrome')]

# Select a device from the array using indexing
motog = pb.devices[0]

# Or retrieve a device by its name. Note that an InvalidKeyError is raised if the name does not exist
motog = pb.get_device('Motorola Moto G')

Now we can use the device objects like we did with pb:

push = motog.push_note("Hello world!", "We're using the api.")

Alternatively we can pass the device to push methods:

push = pb.push_note("Hello world!", "We're using the api.", device=motog)

Creating new devices

Creating a new device is easy too, you only need to specify a name for it.

listener = pb.new_device("Listener")

Now you can use it like any other device.

Editing devices

You can change the nickname, the manufacturer and the model of the device:

listener = pb.edit_device(listener, manufacturer="Python", model="3.4.1")
motog = pb.edit_device(motog, nickname="My MotoG")

Deleting devices

Of course, you can also delete devices, even those not added by you.


A PushbulletError is raised on error.


You can also send pushes to channels. First, create a channel on the Pushbullet website (also make sure to subscribe to that channel). All channels which belong to the current user can be retrieved as follows:

# Get all channels created by the current user
# [Channel('My Channel' 'channel_identifier')]

my_channel = pb.channels[0]

Then you can send a push to all subscribers of this channel like so:

push = my_channel.push_note("Hello Channel!", "Hello My Channel")

Note that you can only push to channels which have been created by the current user.


Contacts, which are known as “Chats” in Pushbullet’s terminilogy, work just like devices:

# Get all contacts the user has
# [Chat('Peter' <>), Chat('Sophie' <>]

sophie = pb.chats[1]

Now we can use the chat objects like we did with pb or with the devices.:

push = sophie.push_note("Hello world!", "We're using the api.")

# Or:
push = pb.push_note("Hello world!", "We're using the api.", chat=sophie)

Adding new chats

bob = pb.new_chat("Bob", "")

Editing chats

You can change the name of any chat:

bob = pb.edit_chat(bob, "bobby")

Deleting chats


Sending SMS messages

device = pb.devices[0]
push = pb.push_sms(device, "+3612345678", "Wowza!")

Error checking

If the Pushbullet api returns an error code a PushError an __ InvalidKeyError or a PushbulletError is raised. The first __ two are both subclasses of PushbulletError

The pushbullet api documetation contains a list of possible status codes.


  • More tests. Write them all.


MIT license. See LICENSE for full text.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution (8.6 kB view hashes)

Uploaded source

Built Distribution (8.8 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page