Before you begin, make sure you have:
python --versionInstall the myosdk package using pip:
pip install myosdk
For production applications, consider using a virtual environment:
# Create virtual environment
python -m venv venv
# Activate it (macOS/Linux)
source venv/bin/activate
# Activate it (Windows)
venv\Scripts\activate
# Install SDK
pip install myosdk
For security, store your API key as an environment variable rather than hardcoding it:
macOS/Linux:
export MYOSDK_API_KEY="your_api_key_here"
Windows (PowerShell):
$env:MYOSDK_API_KEY="your_api_key_here"
Windows (Command Prompt):
set MYOSDK_API_KEY=your_api_key_here
To make it persistent, add it to your shell profile (.bashrc, .zshrc, etc.) or use a .env file with a library like python-dotenv.
Once installed, you can initialize the client:
import os
from myosdk import Client
# Initialize with API key from environment variable
client = Client(api_key=os.getenv("MYOSDK_API_KEY"))
print("Client initialized successfully!")
You can also pass the API key directly (not recommended for production):
from myosdk import Client
client = Client(api_key="your_api_key_here")
Test that everything is working:
import os
from myosdk import Client
client = Client(api_key=os.getenv("MYOSDK_API_KEY"))
# Clean up
client.close()
If you see character data, your installation is working correctly!