def get_aws_browser(): global aws_browser if aws_browser is None: aws_browser = mechanize.Browser() aws_browser.set_handle_robots(False) AWSLoginRequest(aws_browser, admin_info["username"], admin_info["password"], base_url=AWS_BASE_URL).execute() return aws_browser
def get_aws_browser(self): if self._aws_browser is None: self._aws_browser = Browser() lr = AWSLoginRequest(self._aws_browser, self.admin_info["username"], self.admin_info["password"], base_url=self.AWS_BASE_URL) self._aws_browser.login(lr) return self._aws_browser
def get_aws_browser(): global aws_browser if aws_browser is None: aws_browser = Browser() lr = AWSLoginRequest(aws_browser, admin_info["username"], admin_info["password"], base_url=AWS_BASE_URL) aws_browser.login(lr) return aws_browser
def get_aws_session(): global aws_session if aws_session is None: aws_session = BrowserSession() lr = AWSLoginRequest(aws_session, admin_info["username"], admin_info["password"], base_url=AWS_BASE_URL) aws_session.login(lr) return aws_session