asposecloud.common
index
/common.py

 
Modules
       
hashlib
hmac
json
os
re
requests
string

 
Classes
       
Utils

 
class Utils
    A common collection of utility function to perform various tasks.
 
  Methods defined here:
__init__(self)

Static methods defined here:
append_storage(uri, remote_folder='', storage_type='Aspose', storage_name='')
Utility function to help append storage parameters in URI
 
:param uri:
:param remote_folder:
:param storage_type:
:param storage_name:
:return:
build_uri(path, qry_data=None)
URI Builder - Accept path and query string to generate a URI.
 
:param path: e.g http://api.aspose.com/v1/testurl
:param qry_data: a dictionary which holds query string data e.g {'param1': 'value1', 'param2': 'value2'}
:return: returns a uri with query string e.g http://api.aspose.com/v1/testurl?param1=value1&param2=value2
download_file(remote_filename, output_filename, remote_folder='', storage_type='Aspose', storage_name=None)
Download a file from remote storage and save it on local storage.
 
:param remote_filename: filename on remote storage
:param output_filename: filename along with path to store on local storage
: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: output location of the downloaded file
get_filename(filename)
Extract filename without extension
 
:param filename:
:return: filename without extension
save_file(response_stream, filename)
Save a response stream as local file
 
:param response_stream: File Stream
:param filename: File name along with path to store
:return: returns full path of newly created file
sign(url_to_sign)
Add Signature to the url for authentication.
 
:param url_to_sign:
:return: Returns Signed URL
upload_file_binary(local_file, uri)
Upload a local file to provided url
 
:param local_file: path/to/local/file on your local machine
:param uri: target uri to upload file
:return: Response object
validate_result(result)
Validates if an API call have any error in the body.
 
:param result: body of the response
:return: True or False

 
Data
        __author__ = 'AssadMahmood'

 
Author
        AssadMahmood