本文整理汇总了Python中aspose.cloud.common.utils.Utils.get_filename方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.get_filename方法的具体用法?Python Utils.get_filename怎么用?Python Utils.get_filename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aspose.cloud.common.utils.Utils
的用法示例。
在下文中一共展示了Utils.get_filename方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: convert_local_file
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import get_filename [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
示例2: convert_local_file
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import get_filename [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
示例3: convert
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import get_filename [as 别名]
def convert(self):
try:
if self.file_name == "":
raise Exception("Please Specify File Name")
str_uri = Product.base_product_uri + "/slides/" + self.file_name + "?format=" + self.save_format
signed_uri = Utils.sign(self, str_uri)
response_stream = Utils.process_command(Utils(), signed_uri, "GET", "", "")
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
except:
raise
示例4: convert_to_image_by_size
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import get_filename [as 别名]
def convert_to_image_by_size(self, slide_number, image_format, width, height):
try:
if self.file_name == "":
raise Exception("Please Specify File Name")
str_uri = Product.base_product_uri + "/slides/" + self.file_name + "/slides/" + str(slide_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", "", "")
output_path = AsposeApp.output_location + Utils.get_filename(Utils(), self.file_name) + "_slide_" + str(slide_number) + "." + image_format
Utils.save_file(Utils(), response_stream, output_path);
return output_path
except:
raise
示例5: convert_drawing_object
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import get_filename [as 别名]
def convert_drawing_object(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) + "?format=" + render_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(index) + "." + render_format
Utils.save_file(Utils(), response_stream, output_path)
return output_path
else:
return v_output
except:
raise
示例6: convert_to_image
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import get_filename [as 别名]
def convert_to_image(self, page_number, image_format):
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
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
示例7: get_image_custom_size
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import get_filename [as 别名]
def get_image_custom_size(self, page_number, image_index, image_format, width, height):
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 + "&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(image_index) + "." + image_format
Utils.save_file(Utils(), response_stream, output_path)
return output_path
else:
return v_output
except:
raise
示例8: get_autoshape
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import get_filename [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
示例9: save_slide_as
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import get_filename [as 别名]
def save_slide_as(self, slide_number, output_path, save_format):
try:
if self.file_name == "":
raise Exception("Please Specify File Name")
if output_path == "":
raise Exception("Please Specify Output Path")
if save_format == "":
raise Exception("Please Specify Save Format")
if slide_number == "" or slide_number == 0:
raise Exception("Please Specify Slide Number")
str_uri = Product.base_product_uri + "/slides/" + self.file_name + "/slides/" + str(slide_number) + "?format=" + 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 == ""):
Utils.save_file(Utils(), response_stream, output_path + Utils.get_filename(Utils(), self.file_name) + "_" + str(slide_number) + "." + save_format)
return True
else:
return v_output
except:
raise
示例10: save_as
# 需要导入模块: from aspose.cloud.common.utils import Utils [as 别名]
# 或者: from aspose.cloud.common.utils.Utils import get_filename [as 别名]
def save_as(self, output_path, save_format,storage_type = None,storage_name = None,folder=None):
try:
if self.file_name == "":
raise Exception("Please Specify File Name")
if output_path == "":
raise Exception("Please Specify Output Path")
if save_format == "":
raise Exception("Please Specify Save Format")
str_uri = Product.base_product_uri + "/slides/" + self.file_name + "?format=" + save_format
if folder is not None:
str_uri += "?folder=" + folder
if storage_name is not None:
str_uri += "&storage=" + storage_name
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 == ""):
Utils.save_file(Utils(), response_stream, output_path + Utils.get_filename(Utils(), self.file_name) + "." + save_format)
return True
else:
return v_output
except:
raise