Пример #1
0
    def __signin_done(self, val):
        '''Inicio de sesion finalizado'''
        if val.has_key('error'):
            self.ui.cancel_login(val['error'])
        else:
            self.profile = val
            self.config = ConfigHandler(val['screen_name'])
            if self.remember:
                self.global_cfg.write('Login', 'username', self.api.username)
                self.global_cfg.write('Login', 'password',
                                      base64.b64encode(self.api.password))
            else:
                self.global_cfg.write('Login', 'username', '')
                self.global_cfg.write('Login', 'password', '')

            self.httpserv.update_img_dir(self.config.imgdir)
            self.httpserv.set_credentials(self.api.username, self.api.password)

            self.api.muted_users = self.config.load_muted_list()

            self.ui.show_main(self.config, self.global_cfg, self.profile)
            self._update_timeline()
            if self.testmode: return
            self._update_replies()
            self._update_directs()
            self._update_rate_limits()
            self._update_favorites()
            self._update_friends()
Пример #2
0
 def signin(self, username, password, protocol):
     self.config = ConfigHandler(username, protocol)
     self.config.initialize_failsafe()
     auth = self.config.read_section('Auth')
     self.tmp_username = username
     self.tmp_passwd = password
     self.current_protocol = protocol
     self.api.start_oauth(auth, protocol, self.__validate_token)
Пример #3
0
 def __validate_credentials(self, val):
     '''Chequeo de credenciales'''
     if val.type == 'error':
         self.ui.cancel_login(val.errmsg)
     elif val.type == 'profile':
         self.profile = val.items
         self.config = ConfigHandler(self.profile.username, self.current_protocol)
         self.config.initialize()
         
         if self.tmp_key is not None:
             self.config.write('Auth', 'oauth-key', self.tmp_key)
         if self.tmp_secret is not None:
             self.config.write('Auth', 'oauth-secret', self.tmp_secret)
         if self.tmp_verifier is not None:
             self.config.write('Auth', 'oauth-verifier', self.tmp_verifier)
         
         self.httpserv.update_img_dir(self.config.imgdir)
         self.httpserv.set_credentials(self.profile.username, 
             self.profile.password, self.api.protocol.http)
         
         self.__signin_done()
Пример #4
0
 def signin(self, username, password):
     self.config = ConfigHandler(username)
     self.api.auth(username, password, self.__validate_signin)