Skip to content
This repository was archived by the owner on Jul 7, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pushbullet/pushbullet.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Pushbullet(object):
PUSH_URL = "https://api.pushbullet.com/v2/pushes"
UPLOAD_REQUEST_URL = "https://api.pushbullet.com/v2/upload-request"
EPHEMERALS_URL = "https://api.pushbullet.com/v2/ephemerals"
PERMANENTS_URL = "https://api.pushbullet.com/v2/permanents"

def __init__(self, api_key, encryption_password=None, proxy=None):
self.api_key = api_key
Expand Down Expand Up @@ -353,3 +354,17 @@ def refresh(self):
self._load_chats()
self._load_user_info()
self._load_channels()

def get_threads(self, device):
permanents_url = '_threads'
return self._get_permanents(device, permanents_url)

def get_thread(self, device, thread):
permanents_url = '_thread_' + str(thread)
return self._get_permanents(device, permanents_url)

def _get_permanents(self, device, permanents_url):
r = self._session.get(self.PERMANENTS_URL + '/' + device.device_iden + permanents_url)
if r.status_code != requests.codes.ok:
raise PushbulletError(r.text)
return r.json()