def __init__(self, config):
        """

        :param ns1.config.Config config: config object used to build requests
        """
        self._config = config
        self._log = logging.getLogger(__name__)
        # TODO verify we have a default key
        # get a transport. TODO make this static property?
        transport = self._config.get('transport', None)
        if transport is None:
            # for default transport:
            # if requests is available, use that. otherwise, basic
            from ns1.rest.transport.requests import have_requests
            if have_requests:
                transport = 'requests'
            else:
                transport = 'basic'
        if transport not in TransportBase.REGISTRY:
            raise ResourceException('requested transport was not found: %s'
                                    % transport)
        self._transport = TransportBase.REGISTRY[transport](self._config)
def __init__ ( self , config ) : self . _config = config self . _log = logging . getLogger ( __name__ ) transport = self . _config . get ( 'transport' , None ) if transport is None : from ns1 . rest . transport . requests import have_requests if have_requests : transport = 'requests' else : transport = 'basic' if transport not in TransportBase . REGISTRY : raise ResourceException ( 'requested transport was not found: %s' % transport ) self . _transport = TransportBase . REGISTRY [ transport ] ( self . _config )
:param ns1.config.Config config: config object used to build requests