Skip to content

Commit

Permalink
Improve python document.
Browse files Browse the repository at this point in the history
  • Loading branch information
Orisdaddy authored and AxiosLeo committed Sep 27, 2020
1 parent 9ab6386 commit 68ba5da
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 55 deletions.
72 changes: 45 additions & 27 deletions docs/python/0-Usage-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,33 +32,51 @@ from alibabacloud_tea_rpc.models import Config
'''图像搜索示例'''


f = open('pic.jpg', 'rb')
# 初始化Request
request = SearchImageByPicAdvanceRequest(
instance_name='name',
pic_content_object=f
)

# 初始化Config
config = Config(
access_key_id='<your_accsee_key_id>',
access_key_secret='<your_access_key_secret>',
endpoint='<your_endpoint>',
region_id='cn-shanghai',
type='access_key'
)

# 初始化RuntimeObject
runtime_option = RuntimeOptions()

# 初始化Client
client = Client(config)

# 调用api
response = client.search_image_by_pic_advance(request, runtime_option)

print(response.to_map())
f.close()
with open('pic.jpg', 'rb') as f:
# 初始化Request
request = SearchImageByPicAdvanceRequest(
instance_name='name',
pic_content_object=f
)

# 初始化Config
config = Config(
access_key_id='<your_accsee_key_id>',
access_key_secret='<your_access_key_secret>',
endpoint='<your_endpoint>',
region_id='cn-shanghai',
type='access_key'
)

# 初始化RuntimeObject
runtime_option = RuntimeOptions()

# 初始化Client
client = Client(config)

# 调用api
response = client.search_image_by_pic_advance(request, runtime_option)

print(response)
print('request id:', response.request_id)
print('code:', response.code)
print('message:', response.msg)

# head
print('docs return:', response.head.docs_return)
print('docs found:', response.head.docs_found)
print('search time:', response.head.search_time)

# pic info
print('category id:', response.pic_info.category_id)
print('region:', response.pic_info.region)
print('all categories:', response.pic_info.all_categories)

# Auctions
for aut in response.auctions:
print('category id:', aut.category_id)
print('product id:', aut.product_id)

```

## 参数说明
Expand Down
72 changes: 44 additions & 28 deletions docs/python/0-Usage-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,50 @@ from alibabacloud_tea_rpc.models import Config

'''ImageSearch Example'''


f = open('pic.jpg', 'rb')
# init Request
request = SearchImageByPicAdvanceRequest(
instance_name='name',
pic_content_object=f
)

# init Config
config = Config(
access_key_id='<your_accsee_key_id>',
access_key_secret='<your_access_key_secret>',
endpoint='<your_endpoint>',
region_id='cn-shanghai',
type='access_key'
)

# init RuntimeObject
runtime_option = RuntimeOptions()

# init Client
client = Client(config)

# call api
response = client.search_image_by_pic_advance(request, runtime_option)

print(response.to_map())
f.close()
with open('pic.jpg', 'rb') as f:
# init Request
request = SearchImageByPicAdvanceRequest(
instance_name='name',
pic_content_object=f
)

# init Config
config = Config(
access_key_id='<your_accsee_key_id>',
access_key_secret='<your_access_key_secret>',
endpoint='<your_endpoint>',
region_id='cn-shanghai',
type='access_key'
)

# init RuntimeObject
runtime_option = RuntimeOptions()

# init Client
client = Client(config)

# call api
response = client.search_image_by_pic_advance(request, runtime_option)

print(response)
print('request id:', response.request_id)
print('code:', response.code)
print('message:', response.msg)

# head
print('docs return:', response.head.docs_return)
print('docs found:', response.head.docs_found)
print('search time:', response.head.search_time)

# pic info
print('category id:', response.pic_info.category_id)
print('region:', response.pic_info.region)
print('all categories:', response.pic_info.all_categories)

# Auctions
for aut in response.auctions:
print('category id:', aut.category_id)
print('product id:', aut.product_id)
```

## Parameter Specification
Expand Down

0 comments on commit 68ba5da

Please sign in to comment.