Skip to main content

3. Run a sample application

You can interact with Pangea services with either the Java, Python, Node.js, or Golang SDK or directly using the REST APIs. Select a language to learn how to use the SDK from a basic 'Hello, World' example.

Set Environment Variables


Pangea tutorials and samples read each service domain endpoint and access token created in Step 2: Configure Services from an environment variable. Before running this sample, set the environment variables PANGEA_DOMAIN and PANGEA_AUDIT_TOKEN to the values copied from the Pangea Console in the previous step.

To set each variable in bash:

export PANGEA_DOMAIN="yourServiceDomain"
export PANGEA_AUDIT_TOKEN="yourAccessToken"

NOTE: Refer to the Pangea Console dashboard and copy each value using the Screenshot shortcuts.

Run the example from GitHub


Step 1: Clone the pangea-python repo from GitHub, and navigate to the 'examples' directory.

git clone https://github.com/pangeacyber/pangea-python.git &&
cd pangea-python/examples/audit

Step 2: Install dependencies using Poetry

poetry install

Step 3: Run the example code

poetry run python audit_examples/log.py

You should see output that is similar to the output below:

Logging: Hello, World!
Envelope: event={'message': 'Hello, World!'} signature=None public_key=None received_at=datetime.datetime(2023, 8, 30, 20, 43, 34, 742289, tzinfo=datetime.timezone.utc)

Verify the Request


Step 3: Navigate back to the Pangea Console Audit dashboard and confirm that the event was recorded.

Screenshot

Step 4: Then, from the left hand menu, select View Logs to view the specific entries.

Screenshot

Resources