Skip to content
No description or website provided.
Python
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
saaspose
templates
.gitignore
LICENSE
Procfile
README.md
app.py
requirements.txt
test.txt

README.md

Aspose Cloud Heroku Examples for Python

Saaspose is an add-on for providing document automation as a service. Aspose for Cloud is the easiest API to create, convert and automate documents in the cloud.

Aspose for Cloud's REST API allows you to add support for all kinds of common tasks to your Heroku web app: document assembly, mail merge, reporting, file conversion, text and image extraction, metadata removal, barcode generation and recognition, email tracking and creation, targeting content to different devices.

Aspose for Cloud is accessible via an API and has supported client libraries for .NET, Java, Ruby and PHP.

Using with Python

Currently SDK for Python is not stable. But the add-on can easily be used with Python because Aspose is a REST API can be used in any language/platform that can send and receive web request (XML/JSON formats). The necessary methods for authentication and response parsing are included with the sample application in the form of Saaspose.Common package.

The sample code for getting properties of a Word document would be

def docProperties():
    # Initialize the URI, App key and SID
    Product.BaseProductUri = os.environ.get('SAASPOSE_URL', '')
    SaasposeApp.APPKEY = os.environ.get('SAASPOSE_APPKEY', '')
    SaasposeApp.APPSID = os.environ.get('SAASPOSE_APPSID', '')

    responseText = "2. Saaspose.Words<br/><hr/>"
    responseText = responseText + "Sending request to Saaspose for reading document properties....<br/>"

    # Set the file name on Saaspose storage which we want to read
    filename = "DinnerInvitation.docx"

    # Build the URI for sending request
    uri = Product.BaseProductUri + "/words/"
    # Add the file name of Word document
    uri = uri + filename
    # resource
    uri = uri + "/documentproperties"
    # folder
    uri = uri + "?folder="

    # Get the json response
    result = Utils.processCommand(uri, 'GET')
    data = json.loads(result)

    responseText = responseText + "response received.<br/>"

    # Parse the response
    responseText = responseText + "Response from Saaspose: <br/>"
    responseText = responseText + 'Status: ' + data['Status'] + "<br/>"
    responseText = responseText + 'Code: ' + str(data['Code']) + "<br/>"

    responseText = responseText + "<br/>Document properties:<br/>"
    for item in data['DocumentProperties']['List']:
        responseText = responseText + item['Name'] + ': ' + str(item['Value']) + "<br/>"

    responseText = responseText + "<br/><br/>"

    return responseText
Something went wrong with that request. Please try again.