예제 #1
0
    def __init__(self,
                 hostname=TEST_CLOUD_HOSTNAME,
                 port=TEST_CLOUD_PORT,
                 ssl_ca_cert=CERT_DIR + '/rootCA.pem',
                 cert_file=CERT_DIR + '/admin_operator.pem',
                 key_file=CERT_DIR + '/admin_operator.key.pem'):
        self._hostname = hostname
        self._host = 'https://{hostname}:{port}/magma'.format(
            hostname=hostname, port=port)
        self._managed_networks = []  # type: List[str]

        self._ssl_ca = ssl_ca_cert
        self._ssl_cert = cert_file
        self._ssl_key = key_file

        # Set SSL config. NOTE: must be done before creating ApiClient
        configuration = swagger_client.Configuration()
        configuration.ssl_ca_cert = ssl_ca_cert
        configuration.cert_file = cert_file
        configuration.key_file = key_file
        configuration.verify_ssl = True
        configuration.assert_hostname = True

        api_client = swagger_client.ApiClient(host=self._host)

        self.subscribers_api = swagger_client.SubscribersApi(
            api_client=api_client, )
        self.networks_api = swagger_client.NetworksApi(api_client=api_client)
        self.gateways_api = swagger_client.GatewaysApi(api_client=api_client)
        self.tiers_api = swagger_client.TiersApi(api_client=api_client)
        self.channels_api = swagger_client.ChannelsApi(api_client=api_client)
예제 #2
0
파일: cli.py 프로젝트: ytfksw/signate-cli
def set_api_instance(api_token):
    global api_instance
    configuration = swagger_client.Configuration()
    configuration.api_key['Authorization'] = api_token
    configuration.api_key_prefix['Authorization'] = 'Bearer'
    api_instance = swagger_client.DefaultApi(
        swagger_client.ApiClient(configuration))
예제 #3
0
파일: base.py 프로젝트: doitroot/harbor-02
def _create_client(server, credential, debug, api_type="products"):
    cfg = None
    if api_type in ('projectv2', 'artifact', 'repository', 'scan'):
        cfg = v2_swagger_client.Configuration()
    else:
        cfg = swagger_client.Configuration()

    cfg.host = server.endpoint
    cfg.verify_ssl = server.verify_ssl
    # support basic auth only for now
    cfg.username = credential.username
    cfg.password = credential.password
    cfg.debug = debug

    proxies = getproxies()
    proxy = proxies.get('http', proxies.get('all', None))
    if proxy:
        cfg.proxy = proxy
    return {
        "chart":
        client.ChartRepositoryApi(client.ApiClient(cfg)),
        "products":
        swagger_client.ProductsApi(swagger_client.ApiClient(cfg)),
        "projectv2":
        v2_swagger_client.ProjectApi(v2_swagger_client.ApiClient(cfg)),
        "artifact":
        v2_swagger_client.ArtifactApi(v2_swagger_client.ApiClient(cfg)),
        "repository":
        v2_swagger_client.RepositoryApi(v2_swagger_client.ApiClient(cfg)),
        "scan":
        v2_swagger_client.ScanApi(v2_swagger_client.ApiClient(cfg)),
        "scanner":
        swagger_client.ScannersApi(swagger_client.ApiClient(cfg)),
    }.get(api_type, 'Error: Wrong API type')
def get_onprem_api_client(args):
    config = swagger_client.Configuration()
    config.verify_ssl = False
    passwd = getpass.getpass('Please enter vRNI password for username ' + args.vrniuser + ":  ")
    logger.info("Getting api client for IP <{}>".format(args.platform_ip))
    api_client = swagger_client.ApiClient(host="https://{}/api/ni".format(args.platform_ip))
    auth_api = swagger_client.AuthenticationApi(api_client=api_client)
    if args.domain_type == "LOCAL" or args.domain_type == "LDAP":
        user_creds = swagger_client.UserCredential(username=args.vrniuser, password=passwd,
                                                   domain=dict(domain_type=args.domain_type, value=args.domain_value))
        auth_token = auth_api.create(user_creds)
    elif args.domain_type == "VIDM":
        if args.get_vidm_client_id:
            client_id = auth_api.get_vidm_oauth_clien_id()
            logger.info("client-id for vIDM is - '{}'".format(client_id.client_id))
            return
        user_creds = swagger_client.VidmToken(vidm_token=args.vidm_token)
        auth_token = auth_api.create_vidm_user_token(user_creds)
    else:
        raise ValueError('Please give correct domain_type: LOCAL, LDAP or VIDM')

    config.api_key['Authorization'] = auth_token.token
    config.api_key_prefix['Authorization'] = 'NetworkInsight'
    config.api_client = api_client
    return api_client
예제 #5
0
    def updateuser(self):
        if self.name != False:
            if self.x_marketpayuser_id != False:
                # Variables definidas

                marketpay_key = "73a4d867-aeec-4e89-a295-64f14dc25ab9"
                marketpay_secret = "kFNm3CQU-ynHaM5g4OZ4MsSxOqmM85j4lgOVLkCgQYY="
                marketpay_domain = "https://api-sandbox.marketpay.io"

                # Configuración CLiente

                token_url = 'https://api-sandbox.marketpay.io/v2.01/oauth/token'
                key = 'Basic %s' % base64.b64encode(
                    b'73a4d867-aeec-4e89-a295-64f14dc25ab9:kFNm3CQU-ynHaM5g4OZ4MsSxOqmM85j4lgOVLkCgQYY='
                ).decode('ascii')
                data = {'grant_type': 'client_credentials'}
                headers = {
                    'Authorization': key,
                    'Content-Type': 'application/x-www-form-urlencoded'
                }

                r = requests.post(token_url, data=data, headers=headers)

                rs = r.content.decode()
                response = json.loads(rs)
                token = response['access_token']

                # Configuración default de Swagger
                config = swagger_client.Configuration()
                config.host = marketpay_domain
                config.access_token = token
                client = swagger_client.ApiClient(configuration=config)
                api_instance = swagger_client.Configuration.set_default(config)

                apiUser = swagger_client.UsersApi()

                address = swagger_client.Address(
                    address_line1=self.street,
                    address_line2=self.street2,
                    city=self.city,
                    postal_code=self.zip,
                    country=self.x_codigopais_id,
                    region=self.x_nombreprovincia_id)
                user_id = self.x_marketpayuser_id
                user_natural = swagger_client.UserNaturalPut(address=address)
                user_natural.email = self.email
                user_natural.first_name = self.name
                user_natural.occupation = self.function
                user_natural.tag = self.comment
                user_natural.country_of_residence = self.x_codigopais_id
                user_natural.nationality = self.x_codigopais_id

                try:

                    api_response = apiUser.users_put_natural(
                        user_id, user_natural=user_natural)

                except ApiException as e:
                    print("Exception when calling UsersApi->users_put: %s\n" %
                          e)
예제 #6
0
    def setUp(self):
        with open('./config_dev.json') as json_file:
            args = json.load(json_file)
            r = requests.get(os.getenv('TOKEN_URL'),
                             args,
                             headers={'service': 'http://localhost/'})
            at = r.text.split('=')
            token = at[1].split('&')[0]
            self._auth_token = token
            self._region = args['region']

        self._configuration = swagger_client.Configuration()
        self._configuration.access_token = self._auth_token

        conn = boto.cloudformation.connect_to_region(
            self._region)  # or your favorite region
        stacks = conn.describe_stacks('wrighting-example-service-dev')
        if len(stacks) == 1:
            stack = stacks[0]
            for output in stack.outputs:
                if output.key == 'ServiceEndpoint':
                    self._configuration.host = output.value + '/example-service/v1'

#                print('%s=%s (%s)' % (output.key, output.value, output.description))
        else:
            # Raise an exception or something because your stack isn't there
            pass

        self._api_client = swagger_client.ApiClient(self._configuration)
예제 #7
0
파일: __init__.py 프로젝트: k4cg/heiko
    def build_config(self):
        # create an configuration for the general API client
        api_client_config = swagger_client.Configuration()
        api_client_config.host = self._maas_config.host
        api_client_config.verify_ssl = self._maas_config.verify_ssl

        return api_client_config
예제 #8
0
def get_vrnic_api_client(args):
    # determine vRNI Cloud location and use appropriate URL
    if args.cloud_location == "UK":
        VRNIC_FQDN = VRNIC_FQDN_UK
    elif args.cloud_location == "JP":
        VRNIC_FQDN = VRNIC_FQDN_JP
    elif args.cloud_location == "AU":
        VRNIC_FQDN = VRNIC_FQDN_AU
    elif args.cloud_location == "DE":
        VRNIC_FQDN = VRNIC_FQDN_DE
    else:
        VRNIC_FQDN = VRNIC_FQDN_US

    # override Cloud API url if the cloud_api_url param is set
    if args.cloud_api_url != "":
        VRNIC_FQDN = args.cloud_api_url

    # build API client
    public_api_url = "https://{}/ni/api/ni".format(VRNIC_FQDN)
    public_api_client = swagger_client.ApiClient(host=public_api_url)
    config = swagger_client.Configuration()
    config.verify_ssl = False
    logger = logging.getLogger('vrni_sdk')

    logger.info("Getting api client for VRNIC")
    config.api_key['csp-auth-token'] = get_vrnic_csp_auth_token(
        args, config.api_client)
    config.deployment_type = args.deployment_type
    config.api_client = public_api_client
    return public_api_client
예제 #9
0
파일: __init__.py 프로젝트: k4cg/heiko
    def build_config_with_token(self, token):
        api_client_config = swagger_client.Configuration()
        api_client_config.host = self._maas_config.host
        api_client_config.verify_ssl = self._maas_config.verify_ssl
        api_client_config.api_key = {'Authorization': token}
        api_client_config.api_key_prefix = {'Authorization': 'Bearer'}

        return api_client_config
 def __init__(self, info):
     self.info = info
     self.is_setup = False
     configuration = swagger_client.Configuration()
     configuration.api_key['api_key'] = info["token"]
     configuration.host = host
     self.api_instance = swagger_client.ParkspotdataApi(
         swagger_client.ApiClient(configuration))
예제 #11
0
    def __init__(self, host: str, auth_token: str = None, ssl_ca_cert: str = None) -> None:
        self.configuration = swagger_client.Configuration()
        self.configuration.host = host

        if auth_token is not None:
            self.set_auth_token(auth_token)

        self.configuration.ssl_ca_cert = ssl_ca_cert
        self.api_client = swagger_client.ApiClient(self.configuration)
예제 #12
0
async def create_and_maintain_channel(typeautodial, _phone, _channel_id):
    """

    :param typeautodial:
    :param _phone:
    :param _channel_id:
    :return:
    """
    config = Settings(_env_file=env, _env_file_encoding='utf-8')
    configuration = swagger_client.Configuration()
    configuration.host = config.URLARI
    configuration.api_key['api_key'] = config.API_KEY

    async def create_channels_with_id(_phone, _channel_id):
        """

        :param _phone:
        :param _channel_id:
        :return:
        """
        # TODO endpoint - сделать правильно выбор в зависимости от типа звонков(местные, городские, сотовые)
        global endpoint
        api_instance = swagger_client.ChannelsApi(swagger_client.ApiClient(configuration))
        if len(str(_phone)) <= 4:
            # print(f"create_channels_with_id::len(phone): {_phone} = {len(str(_phone))}")
            logger.info(f"|Длинна номера: {_phone}| = {len(str(_phone))}")
            endpoint = 'PJSIP/'
        elif len(str(_phone)) == 10:
            logger.info(f"|Длинна номера: {_phone}| = {len(str(_phone))}")
            endpoint = 'IAX2/Aster4_Aster1/'
        elif len(str(_phone)) == 11:
            logger.info(f"|Длинна номера: {_phone}| = {len(str(_phone))}")
            endpoint = 'IAX2/Aster4_Aster1/'

        endpoint += str(_phone)
        channel_id = _channel_id
        body = swagger_client.Containers()
        label = 'label_example'
        app = 'channel-playback'
        app_args = 'externalCall,' + typeautodial

        caller_id = _phone
        timeout = 60
        api_response = None
        try:
            api_response = api_instance.originate_with_id(endpoint, channel_id, body=body,
                                                          # extension=extension, context=context, priority=priority,
                                                          label=label, app=app, app_args=app_args,
                                                          caller_id=caller_id, timeout=timeout)
        except ApiException as e:
            # print("Exception when calling ChannelsApi->originate_with_id: %s\n" % e)
            logger.exception('exception')
        return api_response

    respone = await create_channels_with_id(_phone, _channel_id)
    # respone = ' '.join(respone)
    return respone
예제 #13
0
파일: base.py 프로젝트: xunknown/harbor
def _create_client(server, credential, debug):
    cfg = swagger_client.Configuration()
    cfg.host = server.endpoint
    cfg.verify_ssl = server.verify_ssl
    # support basic auth only for now
    cfg.username = credential.username
    cfg.password = credential.password
    cfg.debug = debug
    return swagger_client.ProductsApi(swagger_client.ApiClient(cfg))
예제 #14
0
 def __init__(self, access_token=None):
     if access_token is None:
         access_token = os.getenv('STRAVA_ACCESS_TOKEN')
     self.configuration = swagger_client.Configuration()
     self.configuration.access_token = access_token
     self._api_client = swagger_client.ApiClient(self.configuration)
     self.athletes_api = swagger_client.AthletesApi(self._api_client)
     self.activities_api = swagger_client.ActivitiesApi(self._api_client)
     self.streams_api = swagger_client.StreamsApi(self._api_client)
예제 #15
0
def _create_client(server, credential, debug, api_type="products"):
    cfg = None
    if api_type in ('projectv2', 'artifact', 'repository', 'scanner', 'scan',
                    'scanall', 'preheat', 'quota', 'replication', 'robot',
                    'gc', 'retention'):
        cfg = v2_swagger_client.Configuration()
    else:
        cfg = swagger_client.Configuration()

    cfg.host = server.endpoint
    cfg.verify_ssl = server.verify_ssl
    # support basic auth only for now
    cfg.username = credential.username
    cfg.password = credential.password
    cfg.debug = debug

    proxies = getproxies()
    proxy = proxies.get('http', proxies.get('all', None))
    if proxy:
        cfg.proxy = proxy

    if cfg.username is None and cfg.password is None:
        # returns {} for auth_settings for anonymous access
        import types
        cfg.auth_settings = types.MethodType(lambda self: {}, cfg)

    return {
        "chart":
        client.ChartRepositoryApi(client.ApiClient(cfg)),
        "products":
        swagger_client.ProductsApi(swagger_client.ApiClient(cfg)),
        "projectv2":
        v2_swagger_client.ProjectApi(v2_swagger_client.ApiClient(cfg)),
        "artifact":
        v2_swagger_client.ArtifactApi(v2_swagger_client.ApiClient(cfg)),
        "preheat":
        v2_swagger_client.PreheatApi(v2_swagger_client.ApiClient(cfg)),
        "quota":
        v2_swagger_client.QuotaApi(v2_swagger_client.ApiClient(cfg)),
        "repository":
        v2_swagger_client.RepositoryApi(v2_swagger_client.ApiClient(cfg)),
        "scan":
        v2_swagger_client.ScanApi(v2_swagger_client.ApiClient(cfg)),
        "scanall":
        v2_swagger_client.ScanAllApi(v2_swagger_client.ApiClient(cfg)),
        "scanner":
        v2_swagger_client.ScannerApi(v2_swagger_client.ApiClient(cfg)),
        "replication":
        v2_swagger_client.ReplicationApi(v2_swagger_client.ApiClient(cfg)),
        "robot":
        v2_swagger_client.RobotApi(v2_swagger_client.ApiClient(cfg)),
        "gc":
        v2_swagger_client.GcApi(v2_swagger_client.ApiClient(cfg)),
        "retention":
        v2_swagger_client.RetentionApi(v2_swagger_client.ApiClient(cfg)),
    }.get(api_type, 'Error: Wrong API type')
예제 #16
0
 def __init__(self):
     self.spark = SparkSession.builder.appName('clima_hoy').getOrCreate()
     self.spark.sparkContext.setLogLevel('ERROR')
     #Api AEMET
     f = open("/home/rulicering/Datos_Proyecto_Ozono/Credenciales/Credenciales.json")
     credenciales = json.load(f)
     AEMET_API_KEY = credenciales["aemet"]["api_key"]
     configuration = swagger_client.Configuration()
     configuration.api_key['api_key'] = AEMET_API_KEY
     self.api_observacion = swagger_client.ObservacionConvencionalApi(swagger_client.ApiClient(configuration))
예제 #17
0
def swagger_get_activity(token: str, activity_id: int) -> swagger_client.models.detailed_activity:
    configuration = swagger_client.Configuration()
    configuration.access_token = token
    api_instance = swagger_client.ActivitiesApi(swagger_client.ApiClient(configuration))
    try:
        # Get Authenticated Athlete
        api_response = api_instance.get_activity_by_id(activity_id)
        return api_response
    except ApiException as e:
        print("Exception when calling AthletesApi->getLoggedInAthlete: %s\n" % e)  # todo - handle the exception
예제 #18
0
    def __init__(self,
                 access_token=os.environ['STRAVA_ACCESS_TOKEN'],
                 rate_limiter=ratelimiter.RateLimiter(
                     _STRAVA_DEFAULT_MAX_CALLS, _STRAVA_DEFAULT_PERIOD_SEC)):

        configuration = swagger_client.Configuration()
        configuration.access_token = access_token
        self.uploads_api = swagger_client.UploadsApi(
            swagger_client.ApiClient(configuration))
        self.rate_limiter = rate_limiter
예제 #19
0
    def __init__(self, config_file):
        # Configure OAuth2 access token for authorization: OauthSecurity
        auth_token = self.get_access_token(config_file)

        configuration = swagger_client.Configuration()
        if auth_token:
            configuration.access_token = auth_token

        configuration.host = self.remote_host_url

        self._api_client = swagger_client.ApiClient(configuration)
예제 #20
0
    def __init__(self, config_file):
        # Configure OAuth2 access token for authorization: OauthSecurity
        auth_token = self.get_access_token(config_file)

        configuration = swagger_client.Configuration()
        if auth_token:
            configuration.access_token = auth_token

        if os.getenv('REMOTE_HOST_URL'):
            configuration.host = os.getenv('REMOTE_HOST_URL')

        self._api_client = swagger_client.ApiClient(configuration)
def get_vrnic_api_client(args):
    public_api_url = "https://{}/ni/api/ni".format(VRNIC_FQDN)
    public_api_client = swagger_client.ApiClient(host=public_api_url)
    config = swagger_client.Configuration()
    config.verify_ssl = False
    logger = logging.getLogger('vrni_sdk')

    logger.info("Getting api client for VRNIC")
    config.api_key['csp-auth-token'] = get_vrnic_csp_auth_token(args, config.api_client)
    config.deployment_type = args.deployment_type
    config.api_client = public_api_client
    return public_api_client
예제 #22
0
    def __init__(self, host, username, password):
        self.configuration = swagger_client.Configuration()
        self.configuration.host = host
        self.configuration.username = username
        self.configuration.password = password
        # DEBUG FIDDLER
        #self.configuration.proxy = "https://127.0.0.1:8888"
        #self.configuration.verify_ssl = False

        self.metadata_api_instance = swagger_client.MetadataApi(
            swagger_client.ApiClient(self.configuration))
        self.features_api_instance = swagger_client.FeaturesApi(
            swagger_client.ApiClient(self.configuration))
예제 #23
0
def main():
    configuration = swagger_client.Configuration()
    configuration.host = sys.argv[1]
    configuration.api_key['apiKey'] = sys.argv[2]
    api_instance = swagger_client.TeamsApiApi(
        swagger_client.ApiClient(configuration))

    try:
        api_response = api_instance.teams_current_get()
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling TeamsApiApi->teams_current_get: %s\n" %
              e)
예제 #24
0
def swagger_get_activity_streams(token: str, activity_id: int) -> Optional[swagger_client.models.stream_set.StreamSet]:

    configuration = swagger_client.Configuration()
    configuration.access_token = token
    api_instance = swagger_client.StreamsApi(swagger_client.ApiClient(configuration))
    try:
        keys = ['time', 'distance', 'altitude', 'latlng',
                'velocity_smooth', 'heartrate', 'cadence', 'watts', 'temp',
                'moving', 'grade_smooth']
        api_response = api_instance.get_activity_streams(id=activity_id, keys=keys, key_by_type=True)
        return api_response
    except ApiException as e:
        print("Exception when calling AthletesApi->getLoggedInAthlete: %s\n" % e)  # todo - handle the exception
def get_niaas_api_client(args):
    public_api_url = "https://api.mgmt.cloud.vmware.com/ni/api/ni"
    public_api_client = swagger_client.ApiClient(host=public_api_url)
    config = swagger_client.Configuration()
    config.verify_ssl = False
    logger = logging.getLogger('vrni_sdk')

    logger.info("Getting api client for NIAAS")
    config.api_key['csp-auth-token'] = get_niaas_csp_auth_token(
        args, config.api_client)
    config.deployment_type = args.deployment_type
    config.api_client = public_api_client
    return public_api_client
def read_config_file(config_file):
  config = configparser.ConfigParser()
  config.read(config_file)
  configuration = swagger_client.Configuration()
  if config.has_option('default', 'host'):
    configuration.host = config.get('default', 'host')
  else:
    print('Error: config parameter: host missing.')
    exit(1)
  if config.has_option('default', 'id'):
    id = config.get('default', 'id')
  else:
    print('Error: config parameter: id missing.')
    exit(1)
  if config.has_option('default', 'api_username'):
    configuration.username = config.get('default', 'api_username')
  else:
    print('Error: config parameter: api_username missing.')
    exit(1)
  if config.has_option('default', 'api_password'):
    configuration.password = config.get('default', 'api_password')
  else:
    print('Error: config parameter: api_password missing.')
    exit(1)
  if config.has_option('default', 'callbacks'):
    callbacks_config_file = config.get('default', 'callbacks')
  else:
    print('Error: config parameter: callbacks missing.')
    exit(1)
  if config.has_option('default', 'cf_data'):
    cf_data = config.get('default', 'cf_data')
  else:
    print('Error: config parameter: cf_data missing.')
    exit(1)
  if config.has_option('default', 'cf_service'):
    cf_service = config.get('default', 'cf_service')
  else:
    print('Error: config parameter: cf_service missing.')
    exit(1)
  if config.has_option('default', 'cf_username'):
    cf_username = config.get('default', 'cf_username')
  else:
    print('Error: config parameter: cf_username missing.')
    exit(1)
  if config.has_option('default', 'cf_password'):
    cf_password = config.get('default', 'cf_password')
  else:
    print('Error: config parameter: cf_password missing.')
    exit(1)
  return (id, configuration, callbacks_config_file, cf_data, cf_service,
          cf_username, cf_password)
def get_instance_transcription_api():

    # configure API key authorization: subscription_key
    configuration = cris_client.Configuration()
    configuration.api_key["Ocp-Apim-Subscription-Key"] = SUBSCRIPTION_KEY
    configuration.host = f"https://{SERVICE_REGION}.api.cognitive.microsoft.com/speechtotext/v3.0"

    # create the client object and authenticate
    client = cris_client.ApiClient(configuration)

    # create an instance of the transcription api class
    api = cris_client.DefaultApi(api_client=client)

    return api
예제 #28
0
파일: base.py 프로젝트: zmarouf/harbor
def _create_client(server, credential, debug):
    cfg = swagger_client.Configuration()
    cfg.host = server.endpoint
    cfg.verify_ssl = server.verify_ssl
    # support basic auth only for now
    cfg.username = credential.username
    cfg.password = credential.password
    cfg.debug = debug

    proxies = getproxies()
    proxy = proxies.get('http', proxies.get('all', None))
    if proxy:
        cfg.proxy = proxy

    return swagger_client.ProductsApi(swagger_client.ApiClient(cfg))
예제 #29
0
파일: jca-cli.py 프로젝트: mbaser/gluu
    def __init__(self):
        self.host = 'c2.gluu.org'
        self.client_id = '1801.632ef7d0-73af-47f5-8366-8c2dc81dfdac'
        self.client_secret = 'irNzegal0QGB'

        self.swagger_configuration = swagger_client.Configuration()
        self.swagger_configuration.host = 'https://{}'.format(self.host)

        self.swagger_configuration.verify_ssl = False
        self.swagger_configuration.debug = False
        if self.swagger_configuration.debug:
            configuration.logger_file = 'swagger.log'

        self.swagger_yaml_fn = 'myswagger.yaml'
        self.cfg_yml = self.get_yaml()
        self.make_menu()
        self.current_menu = self.menu
예제 #30
0
def _create_client(server, credential, debug, api_type="products"):
    cfg = swagger_client.Configuration()
    cfg.host = server.endpoint
    cfg.verify_ssl = server.verify_ssl
    # support basic auth only for now
    cfg.username = credential.username
    cfg.password = credential.password
    cfg.debug = debug

    proxies = getproxies()
    proxy = proxies.get('http', proxies.get('all', None))
    if proxy:
        cfg.proxy = proxy
    return {
        "products": swagger_client.ProductsApi(swagger_client.ApiClient(cfg)),
        "artifact": v2_swagger_client.ArtifactApi(v2_swagger_client.ApiClient(cfg)),
    }.get(api_type,'Error: Wrong API type')