本文整理汇总了Python中asposecloud.common.Utils.append_storage方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.append_storage方法的具体用法?Python Utils.append_storage怎么用?Python Utils.append_storage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类asposecloud.common.Utils
的用法示例。
在下文中一共展示了Utils.append_storage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_tiff_properties
# 需要导入模块: from asposecloud.common import Utils [as 别名]
# 或者: from asposecloud.common.Utils import append_storage [as 别名]
def update_tiff_properties(self, bit_depth, compression, resolution_unit, new_width, new_height,
horizontal_resolution, vertical_resolution, output_path,
remote_folder='', storage_type='Aspose', storage_name=None):
"""
:param bit_depth:
:param compression:
:param resolution_unit:
:param new_width:
:param new_height:
:param horizontal_resolution:
:param vertical_resolution:
:param output_path:
:param remote_folder:
:param storage_type:
:param storage_name:
:return:
"""
str_uri = Product.product_uri + 'storage/file/' + self.filename
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
file_content = requests.get(signed_uri, headers={
'content-type': 'application/json', 'accept': 'application/json'
}, stream=True)
str_uri = Product.product_uri + 'imaging/tiff'
qry = {'compression': compression, 'resolutionUnit': resolution_unit, 'newWidth' : new_width,
'newHeight' : new_height, 'horizontalResolution' : horizontal_resolution,
'verticalResolution' : vertical_resolution, 'bitDepth' : bit_depth, 'outputPath': output_path}
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, file_content, headers={
'content-type': 'application/json', 'accept': 'application/json'
}, 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 + Utils.get_filename(self.filename) + '_updated.tiff'
Utils.save_file(response, output_path)
return output_path
else:
return validate_output
示例2: extract_frame
# 需要导入模块: from asposecloud.common import Utils [as 别名]
# 或者: from asposecloud.common.Utils import append_storage [as 别名]
def extract_frame(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) + '?saveOtherFrames=false'
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'
}, 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 + Utils.get_filename(self.filename) + '_frame_' + str(frame_id) + '.tiff'
Utils.save_file(response, output_path)
return output_path
else:
return validate_output
return response
示例3: get_tiff_frame_properties
# 需要导入模块: from asposecloud.common import Utils [as 别名]
# 或者: from asposecloud.common.Utils import append_storage [as 别名]
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
示例4: get_text_items
# 需要导入模块: from asposecloud.common import Utils [as 别名]
# 或者: from asposecloud.common.Utils import append_storage [as 别名]
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
示例5: merge_documents
# 需要导入模块: from asposecloud.common import Utils [as 别名]
# 或者: from asposecloud.common.Utils import append_storage [as 别名]
def merge_documents(merged_filename, source_files, remote_folder='', storage_type='Aspose', storage_name=None):
"""
Merge multiple pdf files
:param merged_filename:
:param source_files:
: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({'List': source_files})
str_uri = Product.product_uri + 'pdf/' + merged_filename + '/merge'
str_uri = Utils.append_storage(str_uri, remote_folder, storage_type, storage_name)
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 True if response['Status'] == 'OK' else False
示例6: append_tiff
# 需要导入模块: from asposecloud.common import Utils [as 别名]
# 或者: from asposecloud.common.Utils import append_storage [as 别名]
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
示例7: get_all_text_items
# 需要导入模块: from asposecloud.common import Utils [as 别名]
# 或者: from asposecloud.common.Utils import append_storage [as 别名]
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
示例8: read_from_url
# 需要导入模块: from asposecloud.common import Utils [as 别名]
# 或者: from asposecloud.common.Utils import append_storage [as 别名]
def read_from_url(self, url, symbology=None, remote_folder='', storage_type='Aspose', storage_name=None):
"""
Read a Barcode
:param url:
: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:
"""
if not url:
raise ValueError("url not specified")
str_uri = self.base_uri + '/' + self.filename + '/recognize?url=' + url
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
示例9: upload_file
# 需要导入模块: from asposecloud.common import Utils [as 别名]
# 或者: from asposecloud.common.Utils import append_storage [as 别名]
def upload_file(self, local_file, remote_folder='', storage_type='Aspose', storage_name=None):
"""
Upload a local file to cloud storage.
:param local_file:
: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: returns True or False
"""
if not local_file:
raise ValueError("local_file not specified.")
filename = os.path.basename(local_file)
str_uri = self.str_uri_file
if remote_folder:
str_uri = str_uri + remote_folder + '/'
str_uri += filename
str_uri = Utils.append_storage(str_uri, '', storage_type, storage_name)
signed_uri = Utils.sign(str_uri)
response = Utils.upload_file_binary(local_file, signed_uri).json()
if response['Status'] == 'OK':
return True
else:
return False
示例10: get_aspect_ratio
# 需要导入模块: from asposecloud.common import Utils [as 别名]
# 或者: from asposecloud.common.Utils import append_storage [as 别名]
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
示例11: merge_presentations
# 需要导入模块: from asposecloud.common import Utils [as 别名]
# 或者: from asposecloud.common.Utils import append_storage [as 别名]
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
示例12: replace_all_text
# 需要导入模块: from asposecloud.common import Utils [as 别名]
# 或者: from asposecloud.common.Utils import append_storage [as 别名]
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
示例13: add_custom_property
# 需要导入模块: from asposecloud.common import Utils [as 别名]
# 或者: from asposecloud.common.Utils import append_storage [as 别名]
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
示例14: delete_property
# 需要导入模块: from asposecloud.common import Utils [as 别名]
# 或者: from asposecloud.common.Utils import append_storage [as 别名]
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
示例15: change_slide_position
# 需要导入模块: from asposecloud.common import Utils [as 别名]
# 或者: from asposecloud.common.Utils import append_storage [as 别名]
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