def __init__(self, user=None, password=None): self.session = requests.session() # Use SSL version 1 self.session.mount('https://', SSLAdapter(ssl_version=ssl.PROTOCOL_TLSv1)) # Parser self._parser = SolusParser() self._update_parser = False # Response data self.latest_response = None self.latest_text = None # Recover from errors self.recovery_state = -1 #State of recovery ( < 0 is not recovering, otherwise the current recovery level) self.recovery_stack = [None, None, None, None, None ] #letter, subj subject, course, term, section # Authenticate and navigate to course catalog logging.info("Logging in...") self.login(user, password) logging.info("Navigating to course catalog...") self.go_to_course_catalog() # Should now be on the course catalog page. If not, something went wrong if self.latest_response.url != self.course_catalog_url: # SOLUS Doesn't like requests v2.1.0 (getting error 999, unsupported OS) # Seems to be a quirk of it. The headers don't matter (even user-agent) # Sticking with v2.0.1 until the issue is resolved raise EnvironmentError( "Authenticated, but couldn't access the SOLUS course catalog.")