Skip to content

Commit

Permalink
release 3.1.78 source code
Browse files Browse the repository at this point in the history
  • Loading branch information
Huaweicloud-SDK committed Jan 18, 2024
1 parent a8733b6 commit 829819f
Show file tree
Hide file tree
Showing 1,099 changed files with 35,481 additions and 9,556 deletions.
577 changes: 577 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

577 changes: 577 additions & 0 deletions CHANGELOG_CN.md

Large diffs are not rendered by default.

38 changes: 27 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ http_config.proxy_protocol = 'http'
http_config.proxy_host = 'proxy.huaweicloud.com'
http_config.proxy_port = 80
# Configure the username and password if the proxy requires authentication
# In this example, username and password are stored in environment variables. Please configure the environment variables PROXY_USERNAME and PROXY_PASSWORD before running this example.
http_config.proxy_user = os.getenv("PROXY_USERNAME")
http_config.proxy_password = os.getenv("PROXY_PASSWORD")

Expand Down Expand Up @@ -424,8 +425,8 @@ Getting Authentication from providers is supported since `v3.0.98`

| Environment Variables | Notice |
| ------------ | ------------ |
| HUAWEICLOUD_SDK_AK | RequiredAccessKey |
| HUAWEICLOUD_SDK_SK | RequiredSecretKey |
| HUAWEICLOUD_SDK_AK | Required, AccessKey |
| HUAWEICLOUD_SDK_SK | Required, SecretKey |
| HUAWEICLOUD_SDK_SECURITY_TOKEN | Optional, this parameter needs to be specified when using temporary ak/sk |
| HUAWEICLOUD_SDK_PROJECT_ID | Optional, used for regional services, required in multi-ProjectId scenarios |
| HUAWEICLOUD_SDK_DOMAIN_ID | Optional, used for global services |
Expand Down Expand Up @@ -503,8 +504,8 @@ The profile will be read from the user's home directory by default, linux`~/.hua

| Configuration Parameters | Notice |
| ------------ | ------------ |
| ak | RequiredAccessKey |
| sk | RequiredSecretKey |
| ak | Required, AccessKey |
| sk | Required, SecretKey |
| security_token | Optional, this parameter needs to be specified when using temporary ak/sk |
| project_id | Optional, used for regional services, required in multi-ProjectId scenarios |
| domain_id | Optional, used for global services |
Expand Down Expand Up @@ -732,7 +733,22 @@ credentials = BasicCredentials(ak, sk).with_iam_endpoint(iam_endpoint)

##### 3.3.2 Region configuration [:top:](#user-manual-top)

###### 3.3.2.1 Environment variable [:top:](#user-manual-top)
###### 3.3.2.1 Code [:top:](#user-manual-top)

```python
from huaweicloudsdkcore.region.region import Region
from huaweicloudsdkecs.v2 import EcsClient

# Create a region with custom region id and endpoint
region = Region("cn-north-9", "https://ecs.cn-north-9.myhuaweicloud.com")

client = EcsClient.new_builder() \
.with_credentials(credentials) \
.with_region(region) \
.build()
```

###### 3.3.2.2 Environment variable [:top:](#user-manual-top)

Specified by environment variable, the format is `HUAWEICLOUD_SDK_REGION_{SERVICE_NAME}_{REGION_ID}={endpoint}`

Expand All @@ -754,7 +770,7 @@ A region corresponding to multiple endpoints is supported since **v3.1.60**, if

The format is `HUAWEICLOUD_SDK_REGION_{SERVICE_NAME}_{REGION_ID}={endpoint1},{endpoint2}`, separate multiple endpoints with commas, such as `HUAWEICLOUD_SDK_REGION_ECS_CN_NORTH_9=https://ecs.cn-north-9.myhuaweicloud.com,https://ecs.cn-north-9.myhuaweicloud.cn`

###### 3.3.2.2 Profile [:top:](#user-manual-top)
###### 3.3.2.3 Profile [:top:](#user-manual-top)

The profile will be read from the user's home directory by default, linux`~/.huaweicloud/regions.yaml`,windows`C:\Users\USER_NAME\.huaweicloud\regions.yaml`,the default file may not exist, but if the file exists and the content format is incorrect, an exception will be thrown for parsing errors.

Expand All @@ -763,7 +779,7 @@ The path to the profile can be modified by configuring the environment variable
The file content format is as follows:

```yaml
# Serivce name is case-insensitive
# Service name is case-insensitive
ECS:
- id: 'cn-north-1'
endpoint: 'https://ecs.cn-north-1.myhuaweicloud.com'
Expand All @@ -784,9 +800,9 @@ ECS:
- 'https://ecs.cn-north-1.myhuaweicloud.cn'
```
###### 3.3.2.3 Region supply chain [:top:](#user-manual-top)
###### 3.3.2.4 Region supply chain [:top:](#user-manual-top)
The default order is **environment variables -> profile -> region defined in SDK**, if the region is not found in the above ways, an exception will be thrown.
The default lookup order is **environment variables -> profile -> region defined in SDK** of method **Region.value_of(region_id)**, if the region is not found in the above ways, an exception **KeyError** will be thrown.
```python
from huaweicloudsdkecs.v2.region.ecs_region import EcsRegion
Expand Down Expand Up @@ -948,9 +964,9 @@ if __name__ == "__main__":
HttpHandler supports method `add_request_handler` and `add_response_handler`.

### 7. API Invoker [:top:](#user-manual-top)

#### 7.1 Custom request headers [:top:](#user-manual-top)

You can flexibly configure request headers as needed. **Do not** specify common request headers such as `Host`, `Authorization`, `User-Agent`, `Content-Type` unless necessary, as this may cause the errors.

**Sync invoke**
Expand Down
24 changes: 20 additions & 4 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ http_config.proxy_protocol = 'http'
http_config.proxy_host = 'proxy.huaweicloud.com'
http_config.proxy_port = 80
# 如果代理需要认证,请配置用户名和密码
# 本示例中的账号和密码保存在环境变量中,运行本示例前请先在本地环境中配置环境变量PROXY_USERNAME和PROXY_PASSWORD
http_config.proxy_user = os.getenv("PROXY_USERNAME")
http_config.proxy_password = os.getenv("PROXY_PASSWORD")

Expand Down Expand Up @@ -726,7 +727,22 @@ credentials = BasicCredentials(ak, sk).with_iam_endpoint(iam_endpoint)

##### 3.3.2 Region配置 [:top:](#用户手册-top)

###### 3.3.2.1 环境变量 [:top:](#用户手册-top)
###### 3.3.2.1 代码配置 [:top:](#用户手册-top)

```python
from huaweicloudsdkcore.region.region import Region
from huaweicloudsdkecs.v2 import EcsClient

# 使用自定义的regionId和endpoint创建一个region
region = Region("cn-north-9", "https://ecs.cn-north-9.myhuaweicloud.com")

client = EcsClient.new_builder() \
.with_credentials(credentials) \
.with_region(region) \
.build()
```

###### 3.3.2.2 环境变量 [:top:](#用户手册-top)

通过环境变量配置,格式为`HUAWEICLOUD_SDK_REGION_{SERVICE_NAME}_{REGION_ID}={endpoint}`

Expand All @@ -748,7 +764,7 @@ set HUAWEICLOUD_SDK_REGION_IOTDA_AP_SOUTHEAST_1=https://iotda.ap-southwest-1.myh

格式为`HUAWEICLOUD_SDK_REGION_{SERVICE_NAME}_{REGION_ID}={endpoint1},{endpoint2}`, 多个endpoint之间用英文逗号隔开, 比如`HUAWEICLOUD_SDK_REGION_ECS_CN_NORTH_9=https://ecs.cn-north-9.myhuaweicloud.com,https://ecs.cn-north-9.myhuaweicloud.cn`

###### 3.3.2.2 文件配置 [:top:](#用户手册-top)
###### 3.3.2.3 文件配置 [:top:](#用户手册-top)

通过yaml文件配置,默认会从用户主目录下读取region配置文件,linux为`~/.huaweicloud/regions.yaml`,windows为`C:\Users\USER_NAME\.huaweicloud\regions.yaml`,默认配置文件可以不存在,但是如果配置文件存在且内容格式不对会解析错误抛出异常。

Expand Down Expand Up @@ -778,9 +794,9 @@ ECS:
- 'https://ecs.cn-north-1.myhuaweicloud.cn'
```
###### 3.3.2.3 Region提供链 [:top:](#用户手册-top)
###### 3.3.2.4 Region提供链 [:top:](#用户手册-top)
默认查找顺序为 **环境变量 -> 配置文件 -> SDK中已定义Region**,以上方式都找不到region会抛出异常,获取region示例:
**Region.value_of(region_id)** 默认查找顺序为 **环境变量 -> 配置文件 -> SDK中已定义Region**,以上方式都找不到region会抛出异常 **KeyError**,获取region示例:
```python
from huaweicloudsdkecs.v2.region.ecs_region import EcsRegion
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.77
3.1.78
12 changes: 4 additions & 8 deletions huaweicloud-sdk-aad/huaweicloudsdkaad/v1/region/aad_region.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# coding: utf-8

import types
import six

from huaweicloudsdkcore.region.region import Region
from huaweicloudsdkcore.region.provider import RegionProviderChain

Expand All @@ -19,9 +16,9 @@ class AadRegion:
@classmethod
def value_of(cls, region_id, static_fields=None):
if not region_id:
raise KeyError("Unexpected empty parameter: region_id.")
raise KeyError("Unexpected empty parameter: region_id")

fields = static_fields if static_fields else cls.static_fields
fields = static_fields or cls.static_fields

region = cls._PROVIDER.get_region(region_id)
if region:
Expand All @@ -30,6 +27,5 @@ def value_of(cls, region_id, static_fields=None):
if region_id in fields:
return fields.get(region_id)

raise KeyError("Unexpected region_id: " + region_id)


raise KeyError("region_id '%s' is not in the following supported regions of service 'Aad': [%s]" % (
region_id, ", ".join(sorted(fields.keys()))))
2 changes: 1 addition & 1 deletion huaweicloud-sdk-aad/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
huaweicloudsdkcore >= 3.1.77
huaweicloudsdkcore >= 3.1.78
4 changes: 2 additions & 2 deletions huaweicloud-sdk-aad/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from setuptools import setup, find_packages

NAME = "huaweicloudsdkaad"
VERSION = "3.1.77"
VERSION = "3.1.78"
AUTHOR = "HuaweiCloud SDK"
AUTHOR_EMAIL = "hwcloudsdk@huawei.com"
URL = "https://github.com/huaweicloud/huaweicloud-sdk-python-v3"
Expand All @@ -14,7 +14,7 @@
with open(path.join(this_directory, 'README_PYPI.md'), encoding='utf-8') as f:
LONG_DESCRIPTION = f.read()

REQUIRES = ["huaweicloudsdkcore>=3.1.77"]
REQUIRES = ["huaweicloudsdkcore>=3.1.78"]

OPTIONS = {
'bdist_wheel': {
Expand Down
Loading

0 comments on commit 829819f

Please sign in to comment.