<commit_before>import json

import requests
import magic

from .device import Device

class PushBullet(object):

    DEVICES_URL = "https://api.pushbullet.com/v2/devices"
    PUSH_URL = "https://api.pushbullet.com/v2/pushes"
    UPLOAD_REQUEST_URL = "https://api.pushbullet.com/v2/upload-request"


    def __init__(self, api_key):
        self.api_key = api_key
        self._json_header = {'Content-Type': 'application/json'}

        self._session = requests.Session()
        self._session.auth = (self.api_key, "")
        self._session.headers.update(self._json_header)

        self._load_devices()

    def _load_devices(self):
        self.devices = []

        resp = self._session.get(self.DEVICES_URL)
        resp_dict = resp.json()
        device_list = resp_dict.get("devices", [])

        for device_info in device_list:
            d = Device(self.api_key, device_info)
            d._account = self
            self.devices.append(d)
<commit_msg>Added: getting, dismissing and deleting pushes.<commit_after>import json

import requests
import magic

from .device import Device

class PushBullet(object):

    DEVICES_URL = "https://api.pushbullet.com/v2/devices"
    PUSH_URL = "https://api.pushbullet.com/v2/pushes"
    UPLOAD_REQUEST_URL = "https://api.pushbullet.com/v2/upload-request"


    def __init__(self, api_key):
        self.api_key = api_key
        self._json_header = {'Content-Type': 'application/json'}

        self._session = requests.Session()
        self._session.auth = (self.api_key, "")
        self._session.headers.update(self._json_header)

        self._load_devices()

    def _load_devices(self):
        self.devices = []

        resp = self._session.get(self.DEVICES_URL)
        resp_dict = resp.json()
        device_list = resp_dict.get("devices", [])

        for device_info in device_list:
            d = Device(self.api_key, device_info)
            d._account = self
            self.devices.append(d)

    def get_pushes(self, modified_after=None):
        data = {"modified_after": modified_after}
        r = self._session.get(self.PUSH_URL, params=data) 

        if r.status_code == requests.codes.ok:
            return True, r.json().get("pushes")
        else:
            return False, r.json()

    def dismiss_push(self, iden):
        data = {"dismissed": True}
        r = self._session.post("{}/{}".format(self.PUSH_URL, iden), data=json.dumps(data))
 
        if r.status_code == requests.codes.ok:
            return True, r.json()
        else:
            return False, r.json()

    def delete_push(self, iden):
        r = self._session.delete("{}/{}".format(self.PUSH_URL, iden))
 
        if r.status_code == requests.codes.ok:
            return True, r.json()
        else:
            return False, r.json()

{'fraction_non_alphanumeric': 0.12772808586762074, 'fraction_numerical': 0.002146690518783542, 'mean_word_length': 2.4391143911439115, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '323338', 'n_tokens_mistral': 902, 'n_tokens_neox': 872, 'n_words': 162}