def __init__(self, host, port=443, protocol='https', path_prefix='/katello/api'): super(KatelloServer, self).__init__(host, port, protocol, path_prefix) default_headers = {'Accept': 'application/json', 'content-type': 'application/json', 'User-Agent': 'katello-cli/0.1'} self.headers.update(default_headers) default_locale = locale.getdefaultlocale()[0] if default_locale: accept_lang = default_locale.lower().replace('_', '-') self.headers.update( { 'Accept-Language': accept_lang } ) self._log = getLogger('katello')
def __init__(self, host, port=443, protocol='https', path_prefix='/katello/api', accept_lang=None): assert protocol in ('http', 'https') self.host = host self.port = port self.protocol = protocol self.path_prefix = path_prefix self.headers = {} default_headers = {'Accept': 'application/json', 'content-type': 'application/json', 'User-Agent': 'katello-cli/0.1'} self.headers.update(default_headers) if accept_lang: self.headers.update( { 'Accept-Language': accept_lang } ) self._log = getLogger('katello')
from socket import error as SocketError from urlparse import urlparse from katello.client.config import Config from katello.client.api.utils import ApiDataError from katello.client.core.utils import parse_tokens, SystemExitRequest from katello.client.utils.printer import Printer, GrepStrategy, VerboseStrategy from katello.client.utils.option_validator import OptionValidator from katello.client.utils.encoding import u_str, u_obj from katello.client.logutil import getLogger from katello.client.server import ServerRequestError from copy import copy from optparse import Option, OptionValueError _log = getLogger(__name__) # base command class ---------------------------------------------------------- # # NOTE: If you are adding or removing Commands and Actions you # need to edit: # # katello/bin/kp-cmd # # They contain the mapping and lists of Commands and Actions for # everything the CLI can do. class CommandException(Exception): pass class CommandContainer(object):
from socket import error as SocketError from urlparse import urlparse from katello.client.config import Config from katello.client.api.utils import ApiDataError from katello.client.lib.control import parse_tokens, SystemExitRequest from katello.client.lib.ui.printer import Printer, GrepStrategy, VerboseStrategy from katello.client.lib.utils.option_validator import OptionValidator from katello.client.lib.utils.encoding import u_str, u_obj from katello.client.logutil import getLogger from katello.client.server import ServerRequestError from copy import copy from optparse import Option, OptionValueError _log = getLogger(__name__) # base command class ---------------------------------------------------------- # # NOTE: If you are adding or removing Commands and Actions you # need to edit: # # katello/bin/kp-cmd # # They contain the mapping and lists of Commands and Actions for # everything the CLI can do. class CommandException(Exception): pass