コード例 #1
0
 def get_cws_browser(self, user_id):
     if self._cws_browser is None:
         self._cws_browser = Browser()
         username = self.created_users[user_id]['username']
         password = self.created_users[user_id]['password']
         lr = CWSLoginRequest(
             self._cws_browser, username, password,
             base_url=self.CWS_BASE_URL)
         self._cws_browser.login(lr)
     return self._cws_browser
コード例 #2
0
def get_cws_browser(user_id):
    global cws_browser
    if cws_browser is None:
        cws_browser = Browser()
        username = created_users[user_id]['username']
        password = created_users[user_id]['password']
        lr = CWSLoginRequest(
            cws_browser, username, password, base_url=CWS_BASE_URL)
        cws_browser.login(lr)
    return cws_browser
コード例 #3
0
ファイル: __init__.py プロジェクト: hdi-superuser/cms
def get_cws_browser(user_id):
    global cws_browser
    if cws_browser is None:
        cws_browser = mechanize.Browser()
        cws_browser.set_handle_robots(False)
        cws_browser.set_handle_redirect(False)
        username = created_users[user_id]['username']
        password = created_users[user_id]['password']
        CWSLoginRequest(cws_browser, username, password,
                        base_url=CWS_BASE_URL).execute()
    return cws_browser
コード例 #4
0
def get_cws_session(user_id):
    global cws_session
    if cws_session is None:
        cws_session = BrowserSession()
        cws_session.browser.set_handle_redirect(False)
        username = created_users[user_id]['username']
        password = created_users[user_id]['password']
        lr = CWSLoginRequest(cws_session,
                             username,
                             password,
                             base_url=CWS_BASE_URL)
        cws_session.login(lr)
    return cws_session
コード例 #5
0
 def login(self):
     """Log in and check to be logged in."""
     self.do_step(HomepageRequest(self.browser,
                                  self.username,
                                  loggedin=False,
                                  base_url=self.base_url))
     lr = CWSLoginRequest(self.browser,
                          self.username,
                          self.password,
                          base_url=self.base_url)
     self.browser.read_xsrf_token(lr.base_url)
     self.do_step(lr)
     self.do_step(HomepageRequest(self.browser,
                                  self.username,
                                  loggedin=True,
                                  base_url=self.base_url))