日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

代理配置

更新時間:

本文為您介紹V2.0 Python SDK對于網(wǎng)絡(luò)代理的配置方式。

V2.0 SDK代理配置方式

  • 支持通過運(yùn)行時參數(shù)(RuntimeOption)配置當(dāng)前請求的代理。

    import os
    
    from alibabacloud_ecs20140526.client import Client as EcsClient
    from alibabacloud_ecs20140526.models import DescribeRegionsRequest
    from alibabacloud_tea_openapi.models import Config
    from alibabacloud_tea_util.models import RuntimeOptions
    
    config = Config(
        access_key_id=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID'),
        access_key_secret=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET'),
        endpoint='ecs-cn-hangzhou.aliyuncs.com'
    )
    ecs_client = EcsClient(config)
    
    runtimeOptions = RuntimeOptions(
        http_proxy='http://127.0.0.1:9898',
        https_proxy='http://user:password@127.0.0.1:8989'
    )
    request = DescribeRegionsRequest()
    response = ecs_client.describe_regions_with_options(request, runtimeOptions)
    print(response.body)
    
  • 在初始化客戶端階段,支持通過Config對請求的代理進(jìn)行設(shè)置。

    import os
    
    from alibabacloud_ecs20140526.client import Client as EcsClient
    from alibabacloud_ecs20140526.models import DescribeRegionsRequest
    from alibabacloud_tea_openapi.models import Config
    from alibabacloud_tea_util.models import RuntimeOptions
    
    config = Config(
        access_key_id=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID'),
        access_key_secret=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET'),
        endpoint='ecs-cn-hangzhou.aliyuncs.com',
        http_proxy='http://127.0.0.1:9898',
        https_proxy='http://user:password@127.0.0.1:8989'
    )
    ecs_client = EcsClient(config)
    
    runtimeOptions = RuntimeOptions()
    request = DescribeRegionsRequest()
    response = ecs_client.describe_regions_with_options(request, runtimeOptions)
    print(response.body)
    
  • 支持通過環(huán)境變量配置代理:

    • HTTP_PROXY 或者 http_proxy

    • HTTPS_PROXY或者 https_proxy

說明

代理配置優(yōu)先級為:RuntimeOption->Client->環(huán)境變量,優(yōu)先級依次降低。