示例#1
0
 def metrics(self, metrics):
     for name, results in metrics.items():
         for key,value in results['results'].items():
             logger.info('Pushing %s-%s => %s' % (name, key, repr(value)))
             v, u = value
             try:
                 self.api.update_status('%s-%s => %s %s' % (name, key, repr(v), u))
             except tweepy.error.TweepError as e:
                 logger.error(repr(e.reason))
示例#2
0
 def metrics(self, metrics):
     for name, results in metrics.items():
         for key, value in results['results'].items():
             logger.info('Pushing %s-%s => %s' % (name, key, repr(value)))
             v, u = value
             try:
                 self.api.update_status('%s-%s => %s %s' %
                                        (name, key, repr(v), u))
             except tweepy.error.TweepError as e:
                 logger.error(repr(e.reason))
示例#3
0
 def message(self, msg):
     try:
         if msg['type'] == 'chat':
             self.chat(msg)
         elif msg['type'] == 'error':
             self.error(msg)
         else:
             logger.error('Unknown message type: %s' % self.msgToString(msg))
     except:
         logger.exception('Failed to parse message')
 def metrics(self, metrics):
     d = {}
     for name, results in metrics.items():
         for key,value in results['results'].items():
             d[name + '-' + key] = value
     try:
         response, content = httplib2.Request(self.url, method=self.method, body=json.dumps(d))
         if response != 200:
             logger.error('%s responded with (%i) %s' % (self.url, response, content))
     except httplib2.HttpLib2Error as e:
         logger.error(repr(e))
示例#5
0
 def metrics(self, metrics):
     d = {}
     for name, results in metrics.items():
         for key, value in results['results'].items():
             d[name + '-' + key] = value
     try:
         response, content = httplib2.Request(self.url,
                                              method=self.method,
                                              body=json.dumps(d))
         if response != 200:
             logger.error('%s responded with (%i) %s' %
                          (self.url, response, content))
     except httplib2.HttpLib2Error as e:
         logger.error(repr(e))
示例#6
0
 def err(msg):
     logger.error(repr(msg))
 def err(msg):
     logger.error(repr(msg))
示例#8
0
 def error(self, msg):
     logger.error('Received error %s' % self.msgToString(msg))