Return a dict of API settings derived first from ENV['SENSU_API_URL']
        if set, then Sensu config `api` scope if configured, and finally
        falling back to to ipv4 localhost address on default API port.

        return dict
340490
def get_api_settings(self):
        '''
        
        '''

        sensu_api_url = os.environ.get('SENSU_API_URL')
        if sensu_api_url:
            uri = urlparse(sensu_api_url)
            api_settings = {
                'host': '{0}://{1}'.format(uri.scheme, uri.hostname),
                'port': uri.port,
                'user': uri.username,
                'password': uri.password
            }
        else:
            api_settings = self.settings.get('api', {})
            api_settings['host'] = api_settings.get(
                'host', '127.0.0.1')
            api_settings['port'] = api_settings.get(
                'port', 4567)

        return api_settings
850431
def api_representation(self):
        
        return dict(EmailAddress=dict(Name=self.name, Address=self.email))
1309526
def getEndpoint(self):
        
        port = ''
        endpoint = ''
        keyConfig = self.getKeyConfig()
        if 'port' in keyConfig:
            port = ':' + keyConfig['port']
        elif self._data['port'] != self.PORT:
            port = ':' + self._data['port']
        if 'endpoint' in keyConfig:
            endpoint = keyConfig['endpoint']
        else:
            endpoint = self._data['endpoint']
        return 'https://%s%s/%s/' % (endpoint,
                                     port,
                                     self._data['api_version'])
1038663
def to_dict(self):
        
        data = dict()
        data['api_url'] = self.api_url
        data['api_key'] = self.api_key
        data['verifySSL'] = self.verifySSL
        data['client_id'] = self.client_id
        data['client_secret'] = self.client_secret
        data['redirect_url'] = self.redirect_url
        data['token'] = self.token
        data['state'] = self.state
        data['auth_url'] = self.auth_url
        return data
504772
def get_aliyun_config(name, default=None):
    '''
    
    '''
    config = os.environ.get(name, getattr(settings, name, default))
    if config is not None:
        if isinstance(config, str):
            return config.strip()
        else:
            return config
    else:
        raise ImproperlyConfigured(
            'Can not get config for {} either in environment'
            'variable or in settings.py'.format(name))
862941
def get_api_connector(cls):
        
        if cls._api is None:  # pragma: no cover
            cls.load_config()
            cls.debug('initialize connection to remote server')
            apihost = cls.get('api.host')
            if not apihost:
                raise MissingConfiguration()

            apienv = cls.get('api.env')
            if apienv and apienv in cls.apienvs:
                apihost = cls.apienvs[apienv]

            cls._api = XMLRPCClient(host=apihost, debug=cls.verbose)

        return cls._api
1019954
def _get_config(self, rel_path, view, api_version=1):
    
    self._require_min_api_version(api_version)
    params = view and dict(view=view) or None
    resp = self._get_resource_root().get(self._path() + '/' + rel_path,
        params=params)
    return json_to_config(resp, view == 'full')
344229
def create_api_v4_ipv4(self):
        """"""

        return ApiV4IPv4(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
815826
def __create_handler_settings(config):
    
    server_config = config['conf']['server']
    plugins_conf = config['conf']['plugins_enabled']

    api_handler_settings = {
        'auth_required': server_config.get('auth_required', True),
        'upstream_timeout': server_config.get('upstream_timeout', None),
        'registry': PluginBuilder.build_plugins(plugins_conf),
    }
    if api_handler_settings['auth_required']:
        api_handler_settings['auth_tokens'] = server_config['auth_tokens']

    return {
        APIHandler: api_handler_settings
    }
349845
def get_settings(self):
        
        settings = self.context.getAnalysisServicesSettings()
        mapping = dict(map(lambda s: (s.get("uid"), s), settings))
        return mapping
160022
def create_api_ipv4(self):
        """"""

        return ApiIPv4(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
135712
def _get_environ_overrides() -> Dict[str, str]:
    
    return {
        ce.name: os.environ['OT_API_' + ce.name.upper()]
        for ce in CONFIG_ELEMENTS
        if 'OT_API_' + ce.name.upper() in os.environ}
15876
def set_api_from_config_path(self) -> None:
        """"""
        config = ConfigParser(allow_no_value=False)
        # TODO: Remove this after this issue https://github.com/python/mypy/issues/2427 is closed
        config.optionxform = str  # type:ignore
        config.read(self.config_path, "utf-8")
        if config.has_option("defaults", "dynamic_loading"):
            dynamic_loading = config.get("defaults", "dynamic_loading")
        else:
            dynamic_loading = "infura"
        self._set_rpc(dynamic_loading)
1062119
def _get_config(**api_opts):
    '''
    
    '''
    config = {
        'api_sslverify': True,
        'api_url': 'https://INFOBLOX/wapi/v1.2.1',
        'api_user': '',
        'api_key': '',
    }
    if '__salt__' in globals():
        config_key = '{0}.config'.format(__virtualname__)
        config.update(__salt__['config.get'](config_key, {}))
    # pylint: disable=C0201
    for k in set(config.keys()) & set(api_opts.keys()):
        config[k] = api_opts[k]
    return config
915128
def create_api_network_ipv4(self):
        """"""

        return ApiNetworkIPv4(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
104454
def get_user_input(env):
    """"""

    defaults = config.get_settings_from_client(env.client)

    # Ask for username
    username = env.input('Username', default=defaults['username'])

    # Ask for 'secret' which can be api_key or their password
    secret = env.getpass('API Key or Password', default=defaults['api_key'])

    # Ask for which endpoint they want to use
    endpoint = defaults.get('endpoint_url', 'public')
    endpoint_type = env.input(
        'Endpoint (public|private|custom)', default=endpoint)
    endpoint_type = endpoint_type.lower()

    if endpoint_type == 'public':
        endpoint_url = SoftLayer.API_PUBLIC_ENDPOINT
    elif endpoint_type == 'private':
        endpoint_url = SoftLayer.API_PRIVATE_ENDPOINT
    else:
        if endpoint_type == 'custom':
            endpoint_url = env.input('Endpoint URL', default=endpoint)
        else:
            endpoint_url = endpoint_type

    # Ask for timeout
    timeout = env.input('Timeout', default=defaults['timeout'] or 0)

    return username, secret, endpoint_url, timeout
1150204
def _api_config(self):
        
        response.content_type = 'application/json; charset=utf-8'

        try:
            # Get the JSON value of the config' dict
            args_json = json.dumps(self.config.as_dict())
        except Exception as e:
            abort(404, "Cannot get config (%s)" % str(e))
        return args_json