Hello world
Learn how to get started with Onna and start collecting data
This article explains how to get started with Onna (opens new window) and start collecting data by running a Python program on Linux or macOS.
If you want to know more about how specific Onna features work, check our Help Center (opens new window).
- Install requirements
- Create a trial Onna account
- Create a Workspace
- Set the virtual environment
- Create a Datasource
- Check the Workspace
# Install requirements
To complete the tutorial, install this software on your machine:
- Python 3.8 (opens new window)
- Python Virtual Environment (venv) (opens new window), included with Python 3.8
- Python Package Installer (pip) (opens new window)
# Create an account
Create a trial Onna account from the Sign up page (opens new window).
# Create a Workspace
A Workspace is a collaboration space in Onna where data is collected. Learn how to create one by visiting our Help Center (opens new window).
# Set the virtual environment
Now create a directory for your virtual environment, start the virtual environment, and then activate it.
mkdir ~/onna-six-mins
cd ~/onna-six-mins
python3 -m venv venv
source venv/bin/activate
2
3
4
After activating the virtual environment, install aiohttp in your virtual environment directory.
pip install aiohttp==3.7.4
# Create a Datasource
The script imports dependencies, declares your account information, and then generates an auth token. Finally, it creates a Datasource in your Workspace.
- Download the sample file (opens new window) to the
~/onna-six-mins
directory.
- Edit the file to add your account information.
import asyncio
import aiohttp
import json
base_url = "https://enterprise.onna.com"
container = "CONTAINER"
scope = account = "MYACCOUNT"
auth_code_url = f"{base_url}/api/{container}/{account}/@oauthgetcode?client_id=canonical&scope={account}"
workspace_name = "MYWORKSPACE"
username = "YOUR@EMAIL.COM"
password = "Y0urP#ssWoRD!*"
2
3
4
5
6
7
8
9
10
11
Where:
CONTAINER
is the name of your Onna account. For more info, see the glossary.SCOPE
is the name of your Onna account. For more info, see the glossary.MYACCOUNT
is the name of your Onna accountMYWORKSPACE
is the ID of your workspace from the URL. For example,demoworkspace-ItkUJW
YOUR@EMAIL.COM
is the email you signed up withY0urP#ssWoRD!*
is your super-secret account password
- Run the script.
./venv/bin/python onnasixmins.py
Info
After running the script, remember to deactivate your virtual environment by typing deactivate
in your shell.
# Check the Workspace
Once the request is processed, a new Datasource called Confluence will show in your Workspace. Open that Datasource to find the collected example data.
Tip
Because of the way requests are queued and processed, data may not populate your Workspace immediately. For this reason, check back at regular intervals for the data to show.