def emit(self, record): if len(record.message) > 512: message = "%s..." % (record.message[:-3],) else: message = record.message body_dict = { 'token': self.apikey, 'user': self.userkey, 'message': message, 'priority': self.priority } if self.title is not None: body_dict['title'] = self.title if self.device is not None: body_dict['device'] = self.device if self.sound is not None: body_dict['sound'] = self.sound body = urlencode(body_dict) con = http_client.HTTPSConnection('api.pushover.net') con.request('POST', '/1/messages.json', body=body) con.close()
def emit(self, record): if not self.check_delivery(record)[1]: return body = urlencode({ 'notification[from_screen_name]': self.get_screen_name(record).encode('utf-8'), 'notification[message]': self.make_text(record).encode('utf-8'), 'notification[from_remote_service_id]': str(int(time() * 100)) }) con = http_client.HTTPSConnection('boxcar.io') con.request('POST', '/notifications/', headers={ 'Authorization': 'Basic ' + base64.b64encode((u('%s:%s') % (self.email, self.password)).encode('utf-8')).strip(), }, body=body) con.close()
def emit(self, record): message = self._crop(record.message, self.max_message_len) body_dict = { 'token': self.apikey, 'user': self.userkey, 'message': message, 'priority': self.priority } if self.title is not None: body_dict['title'] = self.title if self.device is not None: body_dict['device'] = self.device if self.sound is not None: body_dict['sound'] = self.sound body = urlencode(body_dict) con = http_client.HTTPSConnection('api.pushover.net') con.request('POST', '/1/messages.json', body=body) con.close()