Esempio n. 1
0
 def check_logged_in(self):
     try:
         content = read_url_and_read(self, MAIN_URL)
     except ClientException as e:
         print e.message
         return False
     welcome_tag = css_select(content, '#welcome')
     if welcome_tag:
         return get_name(welcome_tag[0])
     else:
         return False
Esempio n. 2
0
 def login(self, user, pass_):
     uuid = self._get_uuid()
     params = {'user': user, 'pass': pass_, 'uuid': uuid}
     resp = read_url(self, LOGIN_URL, 'POST', params)
     content = resp.read()
     if not LOGIN_NEXT in content:
         raise LogInException('Login Error')
     read_url(self, LOGIN_OK)
     content = read_url_and_read(self, LOGIN_NEXT)
     #self.save_cookies()
     welcome_tag = css_select(content, '#welcome')
     return get_name(welcome_tag[0])