Login to the database and store cookies for upcoming requests.

def login(self, username, password):
        "Login to the database and store cookies for upcoming requests."
        log.debug("Logging in to the DB")
        opener = self._build_opener()
        values = {'usr': username, 'pwd': password}
        req = self._make_request(self._login_url, values)
        try:
            log.debug("Sending login request")
            f = opener.open(req)
        except URLError as e:
            log.error("Failed to connect to the database -> probably down!")
            log.error("Error from database server:\n    {0}".format(e))
            return False
        html = f.read()
        failed_auth_message = 'Bad username or password'
        if failed_auth_message in str(html):
            log.error(failed_auth_message)
            return False
        return True