# Path: pyhaystack/util/state.py
# @property
# def state(self):
#     """
#     Return the current state machine's state.
#     """
#     return self._state_machine.current
# 
# Path: pyhaystack/util/asyncexc.py
# class AsynchronousException(object):
#     def __init__(self):
#         self._exc_info = exc_info()
# 
#     def reraise(self):
#         reraise(*self._exc_info)
# 
# Path: pyhaystack/client/http/auth.py
# class BasicAuthenticationCredentials(UserPasswordAuthenticationCredentials):
#     """
#     A class that represents Basic authentication.
#     """
# 
#     pass
# 
# Path: pyhaystack/client/http/exceptions.py
# class HTTPStatusError(HTTPBaseError):
#     """
#     Error class to represent a returned failed status from the host.
#     """
# 
#     def __init__(self, message, status, headers=None, body=None):
#         self.headers = headers
#         self.body = body
#         self.status = status
#         super(HTTPStatusError, self).__init__(message, status)


import fysom
import re
from ....util import state
from ....util.asyncexc import AsynchronousException
from ...http.auth import BasicAuthenticationCredentials
from ...http.exceptions import HTTPStatusError
                cookies=self._cookies,
                exclude_cookies=True,
                exclude_proxies=True,
                api=False,
                auth=self._auth,
            )
        except:  # Catch all exceptions to pass to caller.
            self._state_machine.exception(result=AsynchronousException())

    def _on_login(self, response):
        """
        See if the login succeeded.
        """
        try:
            if isinstance(response, AsynchronousException):
                try:
                    response.reraise()
                except HTTPStatusError as e:
                    if e.status == 404:
                        pass
                    else:
                        raise

            else:
                if self._LOGIN_RE.match(response.text):
                    # No good.
                    raise IOError("Login failed")

            self._state_machine.login_done(result=(self._auth, self._cookies))
        except:  # Catch all exceptions to pass to caller.

# Path: pyhaystack/util/state.py
# @property
# def state(self):
#     """
#     Return the current state machine's state.
#     """
#     return self._state_machine.current
# 
# Path: pyhaystack/util/asyncexc.py
# class AsynchronousException(object):
#     def __init__(self):
#         self._exc_info = exc_info()
# 
#     def reraise(self):
#         reraise(*self._exc_info)
# 
# Path: pyhaystack/client/http/auth.py
# class BasicAuthenticationCredentials(UserPasswordAuthenticationCredentials):
#     """
#     A class that represents Basic authentication.
#     """
# 
#     pass
# 
# Path: pyhaystack/client/http/exceptions.py
# class HTTPStatusError(HTTPBaseError):
#     """
#     Error class to represent a returned failed status from the host.
#     """
# 
#     def __init__(self, message, status, headers=None, body=None):
#         self.headers = headers
#         self.body = body
#         self.status = status
#         super(HTTPStatusError, self).__init__(message, status)


# Path: pyhaystack/client/ops/vendor/niagara.py
import fysom
import re
from ....util import state
from ....util.asyncexc import AsynchronousException
from ...http.auth import BasicAuthenticationCredentials
from ...http.exceptions import HTTPStatusError

                cookies=self._cookies,
                exclude_cookies=True,
                exclude_proxies=True,
                api=False,
                auth=self._auth,
            )
        except:  # Catch all exceptions to pass to caller.
            self._state_machine.exception(result=AsynchronousException())

    def _on_login(self, response):
        """
        See if the login succeeded.
        """
        try:
            if isinstance(response, AsynchronousException):
                try:
                    response.reraise()
                except HTTPStatusError as e:
                    if e.status == 404:
                        pass
                    else:
                        raise

            else:
                if self._LOGIN_RE.match(response.text):
                    # No good.
                    raise IOError("Login failed")

            self._state_machine.login_done(result=(self._auth, self._cookies))
        except:  # Catch all exceptions to pass to caller.

            self._state_machine.exception(result=AsynchronousException())