Petal Docs
  • Introduction
  • Connect to muse (Free)
    • Connect muse & Stream Raw Data
      • Connect muse to Mac
      • Connect muse to Windows
  • Receive Data Streams (Free)
    • Receive an LSL Stream
      • Python Examples
      • Node Examples
    • Receive an OSC Stream
      • Python Examples
      • Node Examples
    • Receive Webhooks
      • Python Examples
      • Node Examples
  • Log Data (Free)
    • Logging Data
  • Metrics API (Maker Plan)
    • API Integration
    • Make Metrics API calls
      • Python Examples
      • Node.js Examples
  • Receive Data Streams (Maker Plan)
    • Receive an LSL Stream
      • Python Examples
      • Node Examples
    • Receive an OSC Stream
      • Python Examples
      • Node Examples
    • Receive Webhooks
      • Python Examples
      • Node Examples
  • Glossary of Terms
    • Glossary of Terms
  • 🧪Markers
    • 🧪Markers User Guide
Powered by GitBook
On this page

Was this helpful?

  1. Metrics API (Maker Plan)
  2. Make Metrics API calls

Python Examples

PreviousMake Metrics API callsNextNode.js Examples

Last updated 3 years ago

Was this helpful?

Recommended Installation

For python, we use 3.8.5, but any later 3+ version will probably work.

Create a virtualenv:

pip install venv
python3 -m venv eeg_venv
# activate the venv according to your OS
# Windows example:
. ./eeg_venv/scripts/Activate
pip install -r requirements.txt

This file provides a function to make Petal Metrics API calls.

This script contains an example of a Petal Metrics API call without connecting to any active LSL streams. You will need a valid developer to access.

python api_standalone.py -k $API_KEY

This script demonstrates how to receive an LSL stream and call the Petal API in an endless loop. You will need a valid developer to access.

python api_lsl_call_loop.py -n SimulatedEEGStream -k $API_KEY
api.py
api_standalone.py
API key
api_lsl_call_loop.py
API key