Skip to content

Commit 9e350ee

Browse files
committed
IMAGESEARCH SDK Auto Released By shenshi,Version:1.0.1
发布日志: 1, Update Dependency
1 parent 068ea1a commit 9e350ee

File tree

10 files changed

+32
-234
lines changed

10 files changed

+32
-234
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2019-03-18 Version: 1.0.1
2+
1, Update Dependency
3+
14
2018-05-04 Version: 1.0.1
25
1, Remove some tips
36

aliyun-python-sdk-imagesearch/MANIFEST.in

100755100644
File mode changed.

aliyun-python-sdk-imagesearch/README.rst

100755100644
File mode changed.

aliyun-python-sdk-imagesearch/aliyunsdkimagesearch/__init__.py

100755100644
File mode changed.

aliyun-python-sdk-imagesearch/aliyunsdkimagesearch/request/__init__.py

100755100644
File mode changed.
Lines changed: 9 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -- coding: utf-8 --
2-
31
# Licensed to the Apache Software Foundation (ASF) under one
42
# or more contributor license agreements. See the NOTICE file
53
# distributed with this work for additional information
@@ -19,89 +17,16 @@
1917
# specific language governing permissions and limitations
2018
# under the License.
2119

22-
import base64
2320
from aliyunsdkcore.request import RoaRequest
2421
class AddItemRequest(RoaRequest):
2522

2623
def __init__(self):
27-
RoaRequest.__init__(self, 'ImageSearch', '2018-01-20', 'AddItem','imagesearch')
28-
self.set_uri_pattern('/item/add')
29-
self.set_method('POST')
30-
self.set_accept_format('JSON')
31-
self.item_id = ''
32-
self.cate_id = ''
33-
self.cust_content = ''
34-
self.pic_map = {}
35-
36-
def get_instance_name(self):
37-
return self.get_query_params().get('instanceName')
38-
39-
def set_instance_name(self,instanceName):
40-
self.add_query_param('instanceName',instanceName)
41-
42-
def set_item_id(self, item_id):
43-
self.item_id = item_id
44-
45-
def get_item_id(self):
46-
return self.item_id
47-
48-
def set_cate_id(self, cate_id):
49-
self.cate_id = cate_id
50-
51-
def get_cate_id(self):
52-
return self.cate_id
53-
54-
def set_cust_content(self, cust_content):
55-
self.cust_content = cust_content
56-
57-
def get_cust_content(self):
58-
return self.cust_content
59-
60-
def add_picture(self, pic_name, pic_content):
61-
encoded_pic_name = base64.b64encode(pic_name)
62-
encoded_pic_content = base64.b64encode(pic_content)
63-
self.pic_map[encoded_pic_name] = encoded_pic_content
64-
65-
# Build Post Content
66-
def build_post_content(self):
67-
param_map = {}
68-
# 参数判断
69-
if not self.item_id or not self.cate_id or not self.pic_map:
70-
return False
71-
# 构建参数
72-
param_map['item_id'] = self.item_id
73-
param_map['cat_id'] = self.cate_id
74-
param_map['cust_content'] = self.cust_content
75-
76-
# 遍历图片列表
77-
pic_list_str = ''
78-
for pic_name in self.pic_map:
79-
if not pic_name or not self.pic_map[pic_name]:
80-
return False
81-
pic_list_str += pic_name + ','
82-
param_map[pic_name] = self.pic_map[pic_name]
83-
84-
param_map['pic_list'] = pic_list_str[:-1]
85-
86-
self.set_content(self.build_content(param_map))
87-
88-
return True
89-
90-
# 构建POST的Body内容
91-
def build_content(self, param_map):
92-
# 变量
93-
meta = ''
94-
body = ''
95-
start = 0
96-
97-
# 遍历参数
98-
for key in param_map:
99-
if len(meta) > 0:
100-
meta += '#'
101-
meta += key + ',' + str(start) + ',' + str(start + len(param_map[key]))
102-
body += param_map[key]
103-
start += len(param_map[key])
104-
return meta + '^' + body
105-
106-
107-
24+
RoaRequest.__init__(self, 'ImageSearch', '2018-01-20', 'AddItem','imagesearch')
25+
self.set_uri_pattern('/item/add')
26+
self.set_method('POST')
27+
28+
def get_instanceName(self):
29+
return self.get_query_params().get('instanceName')
30+
31+
def set_instanceName(self,instanceName):
32+
self.add_query_param('instanceName',instanceName)
Lines changed: 10 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -- coding: utf-8 --
2-
31
# Licensed to the Apache Software Foundation (ASF) under one
42
# or more contributor license agreements. See the NOTICE file
53
# distributed with this work for additional information
@@ -18,68 +16,17 @@
1816
# KIND, either express or implied. See the License for the
1917
# specific language governing permissions and limitations
2018
# under the License.
21-
import base64
19+
2220
from aliyunsdkcore.request import RoaRequest
2321
class DeleteItemRequest(RoaRequest):
2422

2523
def __init__(self):
26-
RoaRequest.__init__(self, 'ImageSearch', '2018-01-20', 'DeleteItem','imagesearch')
27-
self.set_uri_pattern('/item/delete')
28-
self.set_method('POST')
29-
self.set_accept_format('JSON')
30-
self.item_id = None
31-
self.pic_list = []
32-
33-
def get_instance_name(self):
34-
return self.get_query_params().get('instanceName')
35-
36-
def set_instance_name(self,instanceName):
37-
self.add_query_param('instanceName',instanceName)
38-
39-
def set_item_id(self, item_id):
40-
self.item_id = item_id
41-
42-
def get_item_id(self):
43-
return self.item_id
44-
45-
def add_picture(self, pic_name):
46-
self.pic_list.append(pic_name)
47-
48-
# Build Post Content
49-
def build_post_content(self):
50-
param_map = {}
51-
# 参数判断
52-
if not self.item_id :
53-
return False
54-
# 构建参数
55-
param_map['item_id'] = self.item_id
56-
57-
# 遍历图片列表
58-
pic_list_str = ''
59-
for pic_name in self.pic_list:
60-
if len(pic_list_str) > 0:
61-
pic_list_str += ','
62-
encode_pic_name = base64.b64encode(pic_name)
63-
pic_list_str += encode_pic_name
64-
65-
param_map['pic_list'] = pic_list_str
66-
67-
self.set_content(self.build_content(param_map))
68-
69-
return True
70-
71-
# 构建POST的Body内容
72-
def build_content(self, param_map):
73-
# 变量
74-
meta = ''
75-
body = ''
76-
start = 0
77-
78-
# 遍历参数
79-
for key in param_map:
80-
if len(meta) > 0:
81-
meta += '#'
82-
meta += key + ',' + str(start) + ',' + str(start + len(param_map[key]))
83-
body += param_map[key]
84-
start += len(param_map[key])
85-
return meta + '^' + body
24+
RoaRequest.__init__(self, 'ImageSearch', '2018-01-20', 'DeleteItem','imagesearch')
25+
self.set_uri_pattern('/item/delete')
26+
self.set_method('POST')
27+
28+
def get_instanceName(self):
29+
return self.get_query_params().get('instanceName')
30+
31+
def set_instanceName(self,instanceName):
32+
self.add_query_param('instanceName',instanceName)
Lines changed: 9 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -- coding: utf-8 --
2-
31
# Licensed to the Apache Software Foundation (ASF) under one
42
# or more contributor license agreements. See the NOTICE file
53
# distributed with this work for additional information
@@ -19,84 +17,16 @@
1917
# specific language governing permissions and limitations
2018
# under the License.
2119

22-
import base64
2320
from aliyunsdkcore.request import RoaRequest
2421
class SearchItemRequest(RoaRequest):
2522

2623
def __init__(self):
27-
RoaRequest.__init__(self, 'ImageSearch', '2018-01-20', 'SearchItem','imagesearch')
28-
self.set_uri_pattern('/item/search')
29-
self.set_method('POST')
30-
self.set_accept_format('JSON')
31-
self.start = 0
32-
self.num = 10
33-
self.cate_id = ''
34-
self.search_picture = ''
35-
36-
def get_instance_name(self):
37-
return self.get_query_params().get('instanceName')
38-
39-
def set_instance_name(self,instanceName):
40-
self.add_query_param('instanceName',instanceName)
41-
42-
def set_start(self, start):
43-
self.start = start
44-
45-
def get_start(self):
46-
return self.start
47-
48-
def set_num(self, num):
49-
self.num = num
50-
51-
def get_num(self):
52-
return self.num
53-
54-
def set_cate_id(self, cate_id):
55-
self.cate_id = cate_id
56-
57-
def get_cate_id(self):
58-
return self.cate_id
59-
60-
def set_search_picture(self, search_picture):
61-
self.search_picture = search_picture
62-
63-
def get_search_picture(self):
64-
return self.search_picture
65-
66-
# Build Post Content
67-
def build_post_content(self):
68-
param_map = {}
69-
# 参数判断
70-
if not self.search_picture :
71-
return False
72-
# 构建参数
73-
param_map['s'] = str(self.start)
74-
param_map['n'] = str(self.num)
75-
if self.cate_id and len(self.cate_id) > 0:
76-
param_map['cat_id'] = self.cate_id
77-
78-
encoded_pic_name = base64.b64encode("searchPic")
79-
encoded_pic_content = base64.b64encode(self.search_picture)
80-
81-
param_map['pic_list'] = encoded_pic_name
82-
param_map[encoded_pic_name] = encoded_pic_content
83-
84-
self.set_content(self.build_content(param_map))
85-
86-
return True
87-
88-
# 构建POST的Body内容
89-
def build_content(self, param_map):
90-
# 变量
91-
meta = ''
92-
body = ''
93-
start = 0
94-
95-
# 遍历参数
96-
for key in param_map:
97-
if len(meta) > 0:
98-
meta += '#'
99-
meta += key + ',' + str(start) + ',' + str(start + len(param_map[key]))
100-
body += param_map[key]
101-
start += len(param_map[key])
102-
return meta + '^' + body
24+
RoaRequest.__init__(self, 'ImageSearch', '2018-01-20', 'SearchItem','imagesearch')
25+
self.set_uri_pattern('/item/search')
26+
self.set_method('POST')
27+
28+
def get_instanceName(self):
29+
return self.get_query_params().get('instanceName')
30+
31+
def set_instanceName(self,instanceName):
32+
self.add_query_param('instanceName',instanceName)

aliyun-python-sdk-imagesearch/aliyunsdkimagesearch/request/v20180120/__init__.py

100755100644
File mode changed.

aliyun-python-sdk-imagesearch/setup.py

100755100644
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,6 @@
4646
finally:
4747
desc_file.close()
4848

49-
requires = []
50-
51-
if sys.version_info < (3, 3):
52-
requires.append("aliyun-python-sdk-core>=2.0.2")
53-
else:
54-
requires.append("aliyun-python-sdk-core-v3>=2.3.5")
55-
5649
setup(
5750
name=NAME,
5851
version=VERSION,
@@ -66,7 +59,7 @@
6659
packages=find_packages(exclude=["tests*"]),
6760
include_package_data=True,
6861
platforms="any",
69-
install_requires=requires,
62+
install_requires=["aliyun-python-sdk-core>=2.11.5",],
7063
classifiers=(
7164
"Development Status :: 4 - Beta",
7265
"Intended Audience :: Developers",

0 commit comments

Comments
 (0)