本文整理汇总了Python中asposecloud.common.Utils类的典型用法代码示例。如果您正苦于以下问题:Python Utils类的具体用法?Python Utils怎么用?Python Utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Utils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_aspect_ratio
def get_aspect_ratio(self, slide_no, remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param slide_no:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
str_uri = self.base_uri + '/slides/' + str(slide_no)
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.get(signed_uri, headers={
'content-type': 'application/json', 'accept': 'application/json'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
return response['Slide']['Width'] / response['Slide']['Height'] if response['Code'] == 200 else False
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:26,代码来源:__init__.py
示例2: read_from_local_image
def read_from_local_image(local_image, symbology):
"""
Read barcode from local image
:param local_image:
:param symbology:
:return: Text of barcode
"""
if not local_image:
raise ValueError("local_image not specified")
filename = os.path.basename(local_image)
str_uri = Product.product_uri + 'storage/file/' + filename
signed_uri = Utils.sign(str_uri)
Utils.upload_file_binary(local_image, signed_uri)
str_uri = Product.product_uri + 'barcode/' + filename + '/recognize'
if symbology:
str_uri += '?type=' + symbology
signed_uri = Utils.sign(str_uri)
response = requests.get(signed_uri, headers={
'content-type': 'application/json', 'accept': 'application/json', 'x-aspose-client' : 'PYTHONSDK/v1.0'
}).json()
return response['Barcodes'] if response['Code'] == 200 else False
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:26,代码来源:__init__.py
示例3: get_tiff_frame_properties
def get_tiff_frame_properties(self, frame_id, remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param frame_id:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
str_uri = self.base_uri + '/frames/' + str(frame_id) + '/properties'
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.get(signed_uri, headers={
'content-type': 'application/json', 'accept': 'application/json'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
return response
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:27,代码来源:__init__.py
示例4: append_tiff
def append_tiff(self, append_file, remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
str_uri = Product.product_uri + 'imaging/tiff/' + self.filename + '/appendTiff'
qry = {'appendFile': append_file}
str_uri = Utils.build_uri(str_uri, qry)
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.post(signed_uri, None, headers={
'content-type': 'application/json', 'accept': 'application/json'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
return response
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:29,代码来源:__init__.py
示例5: get_text_items
def get_text_items(self, page_number, remote_folder='', storage_type='Aspose', storage_name=None):
"""
Get text items from given page number
:param page_number:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
str_uri = self.base_uri + '/pages/' + str(page_number) + '/textitems'
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.get(signed_uri, headers={
'content-type': 'application/json', 'accept': 'application/json', 'x-aspose-client' : 'PYTHONSDK/v1.0'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
return response['TextItems']['List'] if response['TextItems']['List'] else False
开发者ID:AsposeShowcase,项目名称:Aspose_Words_Cloud,代码行数:27,代码来源:__init__.py
示例6: get_all_text_items
def get_all_text_items(self, remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param slide_number:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
str_uri = self.base_uri + '/textItems'
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.get(signed_uri, headers={
'content-type': 'application/json', 'accept': 'application/json'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
return response['TextItems']['Items'] if response['TextItems']['Items'] else False
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:26,代码来源:__init__.py
示例7: read_region
def read_region(self, x, y, w, h, symbology=None, remote_folder='', storage_type='Aspose', storage_name=None):
"""
Read a Barcode
:param x:
:param y:
:param w:
:param h:
:param symbology:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
str_uri = self.base_uri + '/' + self.filename + '/recognize?rectX=' + str(x) + '&rectY=' + str(y)
str_uri += '&rectWidth=' + str(w) + '&rectHeight=' + str(h)
if symbology:
str_uri += '&type=' + symbology
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
response = requests.get(signed_uri, headers={
'content-type': 'application/json', 'accept': 'application/json', 'x-aspose-client' : 'PYTHONSDK/v1.0'
}).json()
return response['Barcodes'] if response['Code'] == 200 else False
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:26,代码来源:__init__.py
示例8: merge_presentations
def merge_presentations(self, presentation_list, remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param presentation_list:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
str_uri = self.base_uri + '/merge'
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
json_data = json.dumps(presentation_list)
response = None
try:
response = requests.put(signed_uri, json_data, headers={
'content-type': 'application/json', 'accept': 'application/json'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
return response['Document'] if response['Code'] == 200 else False
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:27,代码来源:__init__.py
示例9: add_custom_property
def add_custom_property(self, properties_list, remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param properties_list:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
json_data = json.dumps(properties_list)
str_uri = self.base_uri + '/documentProperties'
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.post(signed_uri, json_data, headers={
'content-type': 'application/json', 'accept': 'application/json', 'x-aspose-client' : 'PYTHONSDK/v1.0'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
return response
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:28,代码来源:__init__.py
示例10: delete_property
def delete_property(self, property_name, remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param property_name:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
str_uri = self.base_uri + '/documentProperties/' + property_name
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.delete(signed_uri, headers={
'content-type': 'application/json', 'accept': 'application/json'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
return True if response['Code'] == 200 else False
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:26,代码来源:__init__.py
示例11: change_slide_position
def change_slide_position(self, old_position, new_position, remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param old_position:
:param new_position:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
str_uri = self.base_uri + '/slides?OldPosition=' + str(old_position) + '&NewPosition=' + str(new_position)
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.post(signed_uri, None, headers={
'content-type': 'application/json', 'accept': 'application/json'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
return response
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:27,代码来源:__init__.py
示例12: replace_all_text
def replace_all_text(self, old_text, new_text,
remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param slide_number:
:param old_text:
:param new_text:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
str_uri = self.base_uri + '/replaceText'
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
json_data = json.dumps({'OldValue': old_text, 'NewValue': new_text})
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.post(signed_uri, json_data, headers={
'content-type': 'application/json', 'accept': 'application/json'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
validate_output = Utils.validate_result(response)
if not validate_output:
return True
else:
return validate_output
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:35,代码来源:__init__.py
示例13: get_shape
def get_shape(self, slide_number, shape_index, remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param slide_number:
:param shape_index:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
if not slide_number:
raise ValueError("slide_number not specified")
if not shape_index:
raise ValueError("shape_index not specified")
str_uri = self.base_uri + '/slides/' + str(slide_number) + '/shapes/' + str(shape_index)
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.get(signed_uri, headers={
'content-type': 'application/json', 'accept': 'application/json'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
return response['Shape']
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:33,代码来源:__init__.py
示例14: split_presentation
def split_presentation(self, from_slide, to_slide, destination=None, save_format=None, remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param from_slide:
:param to_slide:
:param destination:
:param save_format:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
str_uri = self.base_uri + '/split'
qry_str = {'from': from_slide, 'to': to_slide}
if(destination):
qry_str['destFolder'] = destination
if(save_format):
qry_str['format'] = save_format
str_uri = Utils.build_uri(str_uri,qry_str)
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.post(signed_uri, None, headers={
'content-type': 'application/json', 'accept': 'application/json'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
return response
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:35,代码来源:__init__.py
示例15: get_attachment
def get_attachment(self, attachment_name, remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param attachment_name:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
if not attachment_name:
raise ValueError("attachment_name not specified")
str_uri = self.base_uri + '/attachments/' + attachment_name
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.get(signed_uri, headers={
'content-type': 'application/json', 'accept': 'application/json', 'x-aspose-client' : 'PYTHONSDK/v1.0'
}, stream=True)
response.raise_for_status()
except requests.HTTPError as e:
print e
print response.content
exit(1)
validate_output = Utils.validate_result(response)
if not validate_output:
output_path = AsposeApp.output_path + attachment_name
Utils.save_file(response, output_path)
return output_path
else:
return validate_output
开发者ID:AsposeShowcase,项目名称:Aspose_Words_Cloud,代码行数:34,代码来源:__init__.py
示例16: add_attachment
def add_attachment(self, attachment_name, remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param attachment_name:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
str_uri = self.base_uri + '/attachments/' + attachment_name
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.post(signed_uri, None, headers={
'content-type': 'application/json', 'accept': 'application/json'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
return response
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:26,代码来源:__init__.py
示例17: set_property
def set_property(self, property_name, property_value, remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param property_name:
:param property_value:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
str_uri = self.base_uri + '/properties/' + property_name
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
json_data = json.dumps({'Value': property_value})
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.put(signed_uri, json_data, headers={
'content-type': 'application/json', 'accept': 'application/json', 'x-aspose-client' : 'PYTHONSDK/v1.0'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
return response['EmailProperty']['Value']
开发者ID:AsposeShowcase,项目名称:Aspose_Words_Cloud,代码行数:29,代码来源:__init__.py
示例18: get_outline_codes
def get_outline_codes(self, remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
str_uri = self.base_uri + '/outlineCodes'
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.get(signed_uri, headers={
'content-type': 'application/json', 'accept': 'application/json', 'x-aspose-client' : 'PYTHONSDK/v1.0'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
return response['OutlineCodes']
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:25,代码来源:__init__.py
示例19: delete_extended_attribute
def delete_extended_attribute(self, attribute_id, remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param attribute_id:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
str_uri = self.base_uri + '/extendedAttributes/' + attribute_id
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.delete(signed_uri, headers={
'content-type': 'application/json', 'accept': 'application/json', 'x-aspose-client' : 'PYTHONSDK/v1.0'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
return response
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:26,代码来源:__init__.py
示例20: add_task
def add_task(self, task_name, before_task_id, remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param task_name:
:param before_task_id:
:param remote_folder: storage path to operate
:param storage_type: type of storage e.g Aspose, S3
:param storage_name: name of storage e.g. MyAmazonS3
:return:
"""
str_uri = self.base_uri + '/tasks'
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
qry = {'taskName': task_name, 'beforeTaskId': before_task_id}
str_uri = Utils.build_uri(str_uri, qry)
signed_uri = Utils.sign(str_uri)
response = None
try:
response = requests.post(signed_uri, None, headers={
'content-type': 'application/json', 'accept': 'application/json', 'x-aspose-client' : 'PYTHONSDK/v1.0'
})
response.raise_for_status()
response = response.json()
except requests.HTTPError as e:
print e
print response.content
exit(1)
return response['TaskItem']
开发者ID:vidyarani-dg,项目名称:Aspose_Cloud_SDK_For_Python,代码行数:30,代码来源:__init__.py
注:本文中的asposecloud.common.Utils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论