def log_error(self, response): document = html5lib.parse(response.content, encoding=response.encoding) content = document.find('.//h:div[@id="contentPanel"]', NS) if content is not None: class_list = (content.get('class') or '').split() if 'error' in class_list: logger.info("contentPanel indicates an error has occurred")
def log_error(self, response): document = html5lib.parse(response.content, encoding=response.encoding) content = document.find('.//h:div[@id="contentPanel"]', NS) if content is not None: class_list = (content.get('class') or '').split() if 'error' in class_list: logger.info("contentPanel indicates an error has occurred")
def wayf_login(self, response): """Login to WAYF. Parameters ---------- response : requests.Response Login page (with username/password form) """ history = list(response.history) + [response] logger.info("Sending login details to WAYF") response = self.session.post(response.url, self.get_auth()) history += list(response.history) + [response] if 'Forkert brugernavn eller kodeord' in response.text: raise BadAuth() response = self.post_hidden_form(response) history += list(response.history) + [response] response = self.post_hidden_form(response) history += list(response.history) + [response] response.history = history[:-1] return response
def wayf_login(self, response): """Login to WAYF. Parameters ---------- response : requests.Response Login page (with username/password form) """ history = list(response.history) + [response] logger.info("Sending login details to WAYF") response = self.session.post(response.url, self.get_auth()) history += list(response.history) + [response] if 'Forkert brugernavn eller kodeord' in response.text: raise BadAuth() response = self.post_hidden_form(response) history += list(response.history) + [response] response = self.post_hidden_form(response) history += list(response.history) + [response] response.history = history[:-1] return response