def on_auth(message):
     nonlocal conf, irc_bot, tg_bot, user_db
     thread = AuthHandler(conf=conf,
                          irc_bot=irc_bot,
                          tg_bot=tg_bot,
                          user_db=user_db,
                          message=message)
     thread.start()
     return thread
Ejemplo n.º 2
0
 def testAuthAttributes(self):
     handler = AuthHandler()
     
     reddit_data = {u'link_karma': 28, u'over_18': False, u'id': u'ahzo1', u'has_verified_email': False, u'created': 1360171116.0, u'is_gold': False, u'comment_karma': 24, u'is_mod': False, u'name': u'Gabicoware_Dan', u'created_utc': 1360171116.0}
     
     attrs = handler._to_user_model_attrs(reddit_data, handler.USER_ATTRS['reddit'])
     
     logging.info(attrs)
     
     self.assertTrue(attrs['link'] == 'http://reddit.com/u/Gabicoware_Dan')
Ejemplo n.º 3
0
 def on_auth(message):
     nonlocal conf, irc_bot, tg_bot, user_db
     thread = AuthHandler(
         conf=conf,
         irc_bot=irc_bot,
         tg_bot=tg_bot,
         user_db=user_db,
         message=message
     )
     thread.start()
     return thread
Ejemplo n.º 4
0
    def handle_accept(self):
        conn, address = self.accept()
        print('new client > ' + str(address))

        broker = RequestBroker(conn, address)
        broker.push_back_handler(AuthHandler.get_instance())
        broker.push_back_handler(CoreHandler.get_instance())
        broker.start()
Ejemplo n.º 5
0
 def run(self):
     # try to read config files
     [authConfig, alarmsConfig, httpdConfig] = \
         config.readConfig(self.data_dir, self.source_dir)
     # create the page handler
     self.authHandler = AuthHandler(authConfig)
     # create action handler
     self.actionHandler = ActionHandler(alarmsConfig, self.authHandler)
     # create the alarms
     self.alarms = {'now': Clock()}
     for (name, alarm) in self.actionHandler:
         self.alarms[name] = AlarmClock(**alarm)
     # create the server
     Server._alarms = self.alarms
     self.server = Server.startServer(**httpdConfig)
     # run the server
     self.server.serve_forever()