Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython

pushbullet.py is unavailable in PyPM, because there aren't any builds for it in the package repositories. Click the linked icons to find out why.

 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
Linux (64-bit)
0.4.0 Failed View build log
0.4.0 Failed View build log
 
Links
License
MIT
Dependencies
Lastest release
version 0.4.0 on Sep 20th, 2013

# PushBullet.py

This is a python library for the wonderful [PushBullet](https://www.pushbullet.com) service. It allows you to send push notifications to Android devices.

In order to use the API you need an API key that can be obtained [here](https://www.pushbullet.com/settings). This is user specific and is used instead of passwords.

## Installation

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 `

## Requirements

  • Python. Tested on 2.7 and 3.
  • The wonderful requests library.

## Usage

### Authentication

```python from pushbullet import PushBullet

System Message: WARNING/2 (<string>, line 31); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 31); backlink

Inline interpreted text or phrase reference start-string without end-string.

pb = PushBullet(api_key)

```

System Message: WARNING/2 (<string>, line 37); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 37); backlink

Inline interpreted text or phrase reference start-string without end-string.

### Getting the devices

```python # Get all devices that the current user has access to. print(pb.devices) # [Device("api_key", 12345)]

System Message: WARNING/2 (<string>, line 41); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 41); backlink

Inline interpreted text or phrase reference start-string without end-string.

# 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() ```

System Message: WARNING/2 (<string>, line 51); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 51); backlink

Inline interpreted text or phrase reference start-string without end-string.

You can also create Device objects directly:

```python from pushbullet import Device

System Message: WARNING/2 (<string>, line 57); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 57); backlink

Inline interpreted text or phrase reference start-string without end-string.

phone = Device(api_key, device_id) ```

System Message: WARNING/2 (<string>, line 60); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 60); backlink

Inline interpreted text or phrase reference start-string without end-string.

This doesn't make a network request.

### Pushing things

#### Pushing a text note

`python push = phone.push_note("This is the title", "This is the body".) `

#### Pushing an address

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

#### Pushing a list

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

#### Pushing a link

`python push = phone.push_link("Cool site", "https://github.com") `

#### Pushing a file

```python with open("my_cool_app.apk", "b") as apk:

System Message: WARNING/2 (<string>, line 95); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 95); backlink

Inline interpreted text or phrase reference start-string without end-string.

System Message: ERROR/3 (<string>, line 97)

Unexpected indentation.
push = phone.push_(apk)

System Message: WARNING/2 (<string>, line 98)

Block quote ends without a blank line; unexpected unindent.

```

System Message: WARNING/2 (<string>, line 98); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 98); backlink

Inline interpreted text or phrase reference start-string without end-string.

#### Error checking

All pushes return the underlying requests object that can be used to check the status of the operation

` Python print(push.status_code) # 200 `

The [pushbullet api documetation](https://www.pushbullet.com/api) contains a list of possible status codes.

## TODO

  • Add better error handling
  • Tests, tests, tests. Write them.

## License

MIT license. See LICENSE for full text.

# Changelog

  • 0.3.0

    • Add list style access to devices.
  • 0.2.1

    • Updated documentation, no code changes.
  • 0.2.0

    • Add support for file uploads.
  • 0.1.1

    • Fix for error during installation.
  • 0.1.0

    • Initial version.

Subscribe to package updates

Last updated Sep 20th, 2013

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.