本文整理汇总了Python中aspose.cloud.common.utils.Utils.validate_output方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.validate_output方法的具体用法?Python Utils.validate_output怎么用?Python Utils.validate_output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aspose.cloud.common.utils.Utils
的用法示例。
在下文中一共展示了Utils.validate_output方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: replace_text
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import validate_output [as 别名]
def replace_text(self, file_name, old_value, new_value, is_match_case, is_match_whole_word):
try:
if file_name == "":
raise Exception("Please Specify File Name")
field_arr = {
"OldValue": old_value,
"NewValue": new_value,
"IsMatchCase": str(is_match_case),
"IsMatchWholeWord": str(is_match_whole_word),
}
json_arr = json.dumps(field_arr)
str_uri = Product.base_product_uri + "/words/" + file_name + "/replaceText"
signed_uri = Utils.sign(Utils(), str_uri)
response_stream = Utils.process_command(Utils(), signed_uri, "POST", "json", json_arr)
v_output = Utils.validate_output(Utils(), response_stream)
if v_output == "":
folder = Folder()
output_stream = folder.get_file(file_name)
output_path = AsposeApp.output_location + file_name
Utils.save_file(Utils(), output_stream, output_path)
return output_path
else:
return v_output
except:
raise
示例2: save
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import validate_output [as 别名]
def save(self, codeText, symbology, imageFormat, xResolution, yResolution, xDimension, yDimension):
strURI = Product.base_product_uri + "/barcode/generate?text=" + codeText + "&type=" + str(symbology) + "&format=" + imageFormat
if xResolution <= 0:
strURI += ""
else:
strURI += "&resolutionX=" + str(xResolution)
if yResolution <= 0:
strURI += ""
else:
strURI += "&resolutionY=" + str(yResolution)
if xDimension <= 0:
strURI += ""
else:
strURI += "&dimensionX=" + str(xDimension)
if yDimension <= 0:
strURI += ""
else:
strURI += "&dimensionY=" + str(yDimension)
try:
signedURI = Utils.sign(Utils(), strURI)
response = Utils.process_command(Utils(), signedURI, "GET", "", "")
v_output = Utils.validate_output(self, response)
if(v_output == ""):
output_path = AsposeApp.output_location + "barcode" + str(symbology) + "." + imageFormat
Utils.save_file(self, response, output_path)
return output_path
except:
raise
示例3: replace_text
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import validate_output [as 别名]
def replace_text(self, old_text, new_text, is_regular_expression=False, page_number=0):
try:
if self.file_name == '':
raise Exception('filename not specified')
if old_text == '':
raise Exception('old text not specified')
if new_text == '':
raise Exception('new text not specified')
post_hash = { "OldValue" : old_text, "NewValue" : new_text, "Regex": "false" }
json_data = json.dumps(post_hash)
if page_number > 0:
str_uri = Product.base_product_uri + "/pdf/" + self.file_name + "/pages/" + str(page_number) + '/replaceText'
else:
str_uri = Product.base_product_uri + "/pdf/" + self.file_name + '/replaceText'
signed_uri = Utils.sign(Utils(), str_uri)
response_stream = Utils.process_command(Utils(), signed_uri, "POST", "json", json_data)
v_output = Utils.validate_output(Utils(), response_stream)
if v_output == "":
folder = Folder()
output_stream = folder.get_file(self.file_name)
output_path = AsposeApp.output_location + self.file_name
Utils.save_file(Utils(), output_stream, output_path)
return output_path
else:
return v_output
except:
raise
示例4: convert_local_file
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import validate_output [as 别名]
def convert_local_file(self, input_file, output_filename, output_format):
try:
if self.file_name == "":
raise Exception("Please Specify File Name")
if input_file == "":
raise Exception("Please Specify Input File Along With Path")
if output_filename == "":
raise Exception("Please Specify Output File Name")
if output_format == "":
raise Exception("Please Specify Output Format")
str_uri = Product.base_product_uri + "/pdf/convert?format=" + output_format
if os.path.exists(input_file) == False:
raise Exception("Input File Does not Exists")
signed_uri = Utils.sign(Utils(), str_uri)
response_stream = Utils.upload_file_binary(Utils(), signed_uri, input_file)
v_output = Utils.validate_output(Utils(), response_stream)
if v_output == "":
if self.save_format == "html":
save_format = "zip"
else:
save_format = output_format
if output_filename == "":
output_path = AsposeApp.output_location + Utils.get_filename(Utils(), input_file) + "." + save_format
else:
output_path = AsposeApp.output_location + output_filename + "." + save_format
Utils.save_file(Utils(), response_stream, output_path)
return output_path
else:
return v_output
except:
raise
示例5: convert_local_file
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import validate_output [as 别名]
def convert_local_file(self, input_filename, output_filename, output_format):
try:
if input_filename == "":
raise Exception("Please Specify Local File Name")
if output_filename == "":
raise Exception("Please Specify Output File Name")
if output_format == "":
raise Exception("Please Specify Output Format")
str_uri = Product.base_product_uri + "/words/convert?format=" + output_format
signed_uri = Utils.sign(Utils(), str_uri)
response_stream = Utils.upload_file_binary(Utils(), signed_uri, input_filename, "xml")
v_output = Utils.validate_output(Utils(), response_stream)
if v_output == "":
if output_format == "html":
save_format = "zip"
else:
save_format = output_format
if output_filename == "":
output_path = AsposeApp.output_location + Utils.get_filename(Utils(), input_filename) + "." + save_format
else:
output_path = AsposeApp.output_location + output_filename + "." + save_format
Utils.save_file(Utils(), response_stream, output_path)
return output_path
else:
return v_output
except:
raise
示例6: insert_watermark_image
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import validate_output [as 别名]
def insert_watermark_image(self, file_name, image_filename, rotation_angle):
try:
if file_name == "":
raise Exception("Please Specify File Name")
if image_filename == "":
raise Exception("Please Specify Image File Name")
str_uri = (
Product.base_product_uri
+ "/words/"
+ file_name
+ "/insertWatermarkImage?imageFile="
+ image_filename
+ "&rotationAngle="
+ str(rotation_angle)
)
signed_uri = Utils.sign(Utils(), str_uri)
response_stream = Utils.process_command(Utils(), signed_uri, "POST", "json", "")
v_output = Utils.validate_output(Utils(), response_stream)
if v_output == "":
folder = Folder()
output_stream = folder.get_file(file_name)
output_path = AsposeApp.output_location + file_name
Utils.save_file(Utils(), output_stream, output_path)
return output_path
else:
return v_output
except:
raise
示例7: get_default_size
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import validate_output [as 别名]
def get_default_size(self, page_number, image_index, image_format):
try:
if self.file_name == "":
raise Exception("Please Specify Pdf File")
str_uri = Product.base_product_uri + "/pdf/" + self.file_name + "/pages/" + str(page_number) + "/images/" + str(image_index) + "?format=" + image_format
signed_uri = Utils.sign(Utils(), str_uri)
response_stream = Utils.process_command(Utils(), signed_uri, "GET", "", "")
v_output = Utils.validate_output(Utils(), response_stream)
if v_output == "":
output_path = AsposeApp.output_location + Utils.get_filename(Utils(), self.file_name) + "_" + str(image_index) + "." + image_format
Utils.save_file(Utils(), response_stream, output_path)
return output_path
else:
return v_output
except:
raise
示例8: convert
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import validate_output [as 别名]
def convert(self):
try:
if self.file_name == "":
raise Exception("Please Specify File Name")
str_uri = Product.base_product_uri + "/words/" + self.file_name + "?format=" + self.save_format
signed_uri = Utils.sign(Utils(), str_uri)
response_stream = Utils.process_command(Utils(), signed_uri, "GET", "", "")
v_output = Utils.validate_output(Utils(), response_stream)
if(v_output == ""):
output_path = AsposeApp.output_location + Utils.get_filename(Utils(), self.file_name) + "." + self.save_format
Utils.save_file(Utils(), response_stream, output_path)
return output_path
else:
return v_output
except:
raise
示例9: get_autoshape
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import validate_output [as 别名]
def get_autoshape(self, worksheet_name, autoshape_index, image_format):
try:
if self.file_name == "":
raise Exception("Please Specify File Name")
str_uri = Product.base_product_uri + "/cells/" + self.file_name + "/worksheets/" + worksheet_name + "/autoshapes/" + str(autoshape_index) + "?format=" + image_format
signed_uri = Utils.sign(Utils(), str_uri)
response_stream = Utils.process_command(Utils(), signed_uri, "GET", "", "")
v_output = Utils.validate_output(Utils(), response_stream)
if v_output == "":
output_path = AsposeApp.output_location + Utils.get_filename(Utils(), self.file_name) + "_" + worksheet_name + "." + image_format
Utils.save_file(Utils(), response_stream, output_path)
return output_path
else:
return v_output
except:
raise
示例10: convert_to_image_by_size
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import validate_output [as 别名]
def convert_to_image_by_size(self, page_number, image_format, width, height):
try:
if self.file_name == "":
raise Exception("Please Specify File Name")
str_uri = Product.base_product_uri + "/pdf/" + self.file_name + "/pages/" + str(page_number) + "?format=" + image_format + "&width=" + str(width) + "&height" + str(height)
signed_uri = Utils.sign(Utils(), str_uri)
response_stream = Utils.process_command(Utils(), signed_uri, "GET", "", "")
v_output = Utils.validate_output(Utils(), response_stream)
if v_output == "":
output_path = AsposeApp.output_location + Utils.get_filename(Utils(), self.file_name) + "_" + str(page_number) + "." + image_format
Utils.save_file(Utils(), response_stream, output_path)
return output_path
else:
return v_output
except:
raise
示例11: get_image_data
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import validate_output [as 别名]
def get_image_data(self, index, render_format):
try:
if self.file_name == "":
raise Exception("Please Specify File Name")
str_uri = Product.base_product_uri + "/words/" + self.file_name + "/drawingObjects/" + str(index) + "/ImageData"
signed_uri = Utils.sign(Utils(), str_uri)
response_stream = Utils.process_command(Utils(), signed_uri, "GET", "", "")
v_output = Utils.validate_output(Utils(), response_stream)
if v_output == "":
output_path = AsposeApp.output_location + Utils.get_filename(Utils(), self.file_name) + "_" + str(index) + "." + render_format
Utils.save_file(Utils(), response_stream, output_path)
return output_path
else:
return v_output
except:
raise
示例12: download_attachment
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import validate_output [as 别名]
def download_attachment(self, attachment_index):
try:
if self.file_name == "":
raise Exception("Please Specify File Name")
file_information = self.get_attachment(attachment_index)
str_uri = Product.base_product_uri + "/pdf/" + self.file_name + "/attachments/" + str(attachment_index) + "/download"
signed_uri = Utils.sign(Utils(), str_uri)
response_stream = Utils.process_command(Utils(), signed_uri, "GET", "", "")
v_output = Utils.validate_output(Utils(), response_stream)
if v_output == "":
output_path = AsposeApp.output_location + file_information["Name"]
Utils.save_file(Utils, response_stream, output_path)
return output_path
else:
return v_output
except:
raise
示例13: insert_watermark_text
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import validate_output [as 别名]
def insert_watermark_text(self, file_name, text, rotation_angle):
try:
if file_name == "":
raise Exception("Please Specify File Name")
field_array = {"Text": text, "RotationAngle": str(rotation_angle)}
json_post_data = json.dumps(field_array)
str_uri = Product.base_product_uri + "/words/" + file_name + "/insertWatermarkText"
signed_uri = Utils.sign(Utils(), str_uri)
response_stream = Utils.process_command(Utils(), signed_uri, "POST", "json", json_post_data)
v_output = Utils.validate_output(Utils(), response_stream)
if v_output == "":
folder = Folder()
output_stream = folder.get_file(file_name)
output_path = AsposeApp.output_location + file_name
Utils.save_file(Utils(), output_stream, output_path)
return output_path
else:
return v_output
except:
raise
示例14: insert_page_number
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import validate_output [as 别名]
def insert_page_number(self, file_name, alignment, text_format, is_top, set_page_number_on_first_page):
try:
if file_name == "":
raise Exception("Please Specify File Name")
field_arr = {"Format" : text_format , "Alignment" : alignment, "IsTop" : str(is_top), "SetPageNumberOnFirstPage" : str(set_page_number_on_first_page)}
json_data = json.dumps(field_arr)
str_uri = Product.base_product_uri + "/words/" + file_name + "/insertPageNumbers"
signed_uri = Utils.sign(Utils(), str_uri)
response_stream = Utils.process_command(Utils(), signed_uri, "POST", "json", json_data)
v_output = Utils.validate_output(Utils(), response_stream)
if v_output == "":
folder = Folder()
output_stream = folder.get_file(file_name)
output_path = AsposeApp.output_location + file_name
Utils.save_file(Utils(), output_stream, output_path)
return output_path
else:
return v_output
except:
raise
示例15: add_chart
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import validate_output [as 别名]
def add_chart(self, chart_type, upper_left_row, upper_left_column, lower_right_row, lower_right_column):
try:
if self.file_name == "":
raise Exception("Please Specify File Name")
if self.worksheet_name == "":
raise Exception("Please Specify Worksheet Name")
str_uri = Product.base_product_uri + "/cells/" + self.file_name + "/worksheets/" + self.worksheet_name + "/charts?chartType=" + chart_type + "&upperLeftRow=" + str(upper_left_row) + "&upperLeftColumn=" + str(upper_left_column) + "&lowerRightRow=" + str(lower_right_row) + "&lowerRightColumn=" + str(lower_right_column)
signed_uri = Utils.sign(Utils(), str_uri)
response_stream = Utils.process_command(Utils(), signed_uri, "PUT", "", "")
v_output = Utils.validate_output(Utils(), response_stream)
if v_output == "":
folder = Folder()
output_stream = folder.get_file(self.file_name)
output_path = AsposeApp.output_location + self.file_name
Utils.save_file(Utils(), output_stream, output_path)
return output_path
else:
return v_output
except:
raise