コード例 #1
0
    def push(self, device, type, param1, param2 = None, callback = None, err_callback = None):
        data = {
            'device_iden': device,
            'type': type
        }
        files = None

        if type == 'note':
            data['title'] = param1
            data['body'] = param2
        elif type == 'link':
            data['title'] = param1
            data['url'] = param2
        elif type == 'address':
            data['name'] = param1
            data['address'] = param2
        elif type == 'list':
            data['title'] = param1
            data['list'] = param2
        #elif type == 'file':
        #    files = {file: open(param1)}
        else:
            raise PushbulletException(-1, 'Invalid push type specified')

        p = Post(self.api_base + 'pushes', data=data, auth=self.api_auth, files=files, callback=callback, err_callback=err_callback, use_params=False)
        p.start()
コード例 #2
0
ファイル: boxcar.py プロジェクト: bhdouglass/remindor-common
 def notify(self, title, message, callback = None, err_callback = None):
     data = {'user_credentials': self.token, 'notification[title]': title,
             'notification[long_message]': message, 'notification[source_name]': 'Remindor'}
     b = Post(self.api_url, data)
     b.start()