# Path: katprep/management/base.py
# class BaseConnector(metaclass=ABCMeta):
#     """
#     Basic management connector that connects on creation.
#     """
# 
#     def __init__(self, username, password, **kwargs):
#         self._username = username
#         self._password = password
#         self._session = None
#         self._connect()
# 
#     @abstractmethod
#     def _connect(self):
#         pass
# 
# Path: katprep/exceptions.py
# class APILevelNotSupportedException(Exception):
#     """
#     Dummy class for unsupported API levels
# 
#     .. class:: APILevelNotSupportedException
#     """
# 
# class InvalidCredentialsException(Exception):
#     """
#     Dummy class for invalid credentials
# 
#     .. class:: InvalidCredentialsException
#     """
# 
# class SessionException(Exception):
#     """
#     Dummy class for session errors
# 
#     .. class:: SessionException
#     """


import logging
from .base import BaseConnector
from ..exceptions import (APILevelNotSupportedException, InvalidCredentialsException,
                         SessionException)
    from xmlrpc.server import SimpleXMLRPCServer as Server
    from xmlrpc.client import Fault
    from xmlrpclib import Server, Fault

        #start session and check API version if Spacewalk API
        self.api_key = None
        super().__init__(username, password)
        self.validate_api_support()



    def __exit__(self, exc_type, exc_value, traceback):
        """
        Destructor
        """
        self.api_session.auth.logout(self.api_key)



    def _connect(self):
        """
        This function establishes a connection to Spacewalk.
        """
        #set api session and key
        try:
            self._session = Server(self.url)
            self.api_key = self._session.auth.login(self._username, self._password)
        except Fault as err:
            if err.faultCode == 2950:
                raise InvalidCredentialsException(
                    "Wrong credentials supplied: '%s'", err.faultString
                )
            else:

# Path: katprep/management/base.py
# class BaseConnector(metaclass=ABCMeta):
#     """
#     Basic management connector that connects on creation.
#     """
# 
#     def __init__(self, username, password, **kwargs):
#         self._username = username
#         self._password = password
#         self._session = None
#         self._connect()
# 
#     @abstractmethod
#     def _connect(self):
#         pass
# 
# Path: katprep/exceptions.py
# class APILevelNotSupportedException(Exception):
#     """
#     Dummy class for unsupported API levels
# 
#     .. class:: APILevelNotSupportedException
#     """
# 
# class InvalidCredentialsException(Exception):
#     """
#     Dummy class for invalid credentials
# 
#     .. class:: InvalidCredentialsException
#     """
# 
# class SessionException(Exception):
#     """
#     Dummy class for session errors
# 
#     .. class:: SessionException
#     """


# Path: katprep/management/spacewalk.py
import logging
from .base import BaseConnector
from ..exceptions import (APILevelNotSupportedException, InvalidCredentialsException,
                         SessionException)
    from xmlrpc.server import SimpleXMLRPCServer as Server
    from xmlrpc.client import Fault
    from xmlrpclib import Server, Fault


        #start session and check API version if Spacewalk API
        self.api_key = None
        super().__init__(username, password)
        self.validate_api_support()



    def __exit__(self, exc_type, exc_value, traceback):
        """
        Destructor
        """
        self.api_session.auth.logout(self.api_key)



    def _connect(self):
        """
        This function establishes a connection to Spacewalk.
        """
        #set api session and key
        try:
            self._session = Server(self.url)
            self.api_key = self._session.auth.login(self._username, self._password)
        except Fault as err:
            if err.faultCode == 2950:
                raise InvalidCredentialsException(
                    "Wrong credentials supplied: '%s'", err.faultString
                )
            else:

                raise SessionException(