SDK – Useful Snippets

In this page are some ready-made snippets which you may use in their entirety or as a starting point in using the Ango SDK.

Environmental Variables

Snippets in this page make the assumption that you have your API key and other variables set as environmental variables.

To set environmental variables, install the python-dotenv package from pip by running

pip install python-dotenv

in your Python environment.

Then, create a file called .env in your environment's root folder. The contents of this .env file will look like this:


In your Python scripts, then, import the package by using

from dotenv import load_dotenv
import os

and load the environmental variables by running load_dotenv() before using the variables in your script.

You will then be able to access your environmental variables by using os.getenv("VAR_NAME"), like so:

API_KEY = os.getenv("API_KEY")

Create a new project with the category schema and workflow of an existing one

from imerit_ango.sdk import SDK # Minimum version 1.3.12
from dotenv import load_dotenv
import os

# Import the API Key and Project ID from the .env file
apiKey = os.getenv('api_key')
projectId = os.getenv('project_id')

# Create an instance of the SDK, using the API Key
ango_sdk = SDK(apiKey)

# Get Existing Project Response
existing_project_response = \

# Copy the Workflow from the Existing Project
copied_workflow = \

# Copy the Category Schema from the Existing Project
copied_categories = \

# Create new project and get the project id     
new_project_id = \
            "New Project", 
            "with copied category schema and workflows"
print("New Project ID: ", new_project_id)

# Import copied category schema to the new project id
copied_cat_resp = \
            raw_category_schema = copied_categories
print("Copied Category Schema Response: ", copied_cat_resp.get("status"))

# Import copied workflow to the new project id
copied_workflow_resp = \
print("Copied Workflow Response: ", copied_workflow_resp.get("status"))

Last updated