Skip to content

Installation

Quick Start

The Urban Sky SDK is available for JavaScript and Python. Choose your preferred language below.

JavaScript/TypeScript

Prerequisites

Install the real-time WebSocket client alongside the SDK:

bash
npm install centrifuge

Requirements:

  • Node.js 18+
  • centrifuge (^5.5.3) — real-time WebSocket client, a required peer dependency

Note: centrifuge is a peer dependency and is deliberately excluded from the SDK bundle, so you must install it yourself. HTTP requests do use Node.js built-in modules (https, http, url), so no additional HTTP client is required.

Using the CDN Loader

Load the SDK dynamically in your Node.js application:

javascript
// Load the SDK dynamically
const response = await fetch('https://sdk.atmosys.com/runtime/js/current/loader.js')
const loaderCode = await response.text()
eval(loaderCode) // Loads the latest SDK version

// SDK is now available as UrbanSkySDK
const sdk = await UrbanSkySDK.init({
  apiToken: process.env.URBAN_SKY_API_TOKEN,
})

Python

Prerequisites

Install the real-time WebSocket client:

bash
pip install centrifuge-python

Requirements:

  • Python 3.8+
  • centrifuge-python (>=0.3.0) - real-time WebSocket client, a required dependency

Note: centrifuge-python is a hard dependency of the SDK, not an optional extra, and it must be available in your environment. The SDK runtime itself is fetched from the CDN by the loader.

Using the CDN Loader

Load the SDK dynamically in your Python application:

python
import asyncio
import os

import requests  # pip install requests

# Loads the latest SDK version
exec(requests.get('https://sdk.atmosys.com/runtime/py/current/loader.py').text)

async def main():
    # SDK is now available as UrbanSkySDK
    sdk = await UrbanSkySDK.init({
        'apiToken': os.getenv('URBAN_SKY_API_TOKEN')
    })

asyncio.run(main())

Environment Setup

Environment Variables

Set up your environment variables:

bash
# .env file
URBAN_SKY_API_TOKEN=your-api-token-here

Verification

Test Your Installation

JavaScript:

javascript
try {
  const sdk = await UrbanSkySDK.init({
    apiToken: 'your-api-token',
  })
  console.log('✅ SDK connected successfully!')
} catch (err) {
  console.error('❌ Connection failed:', err)
}

Python:

python
import asyncio

async def test_connection():
    try:
        sdk = await UrbanSkySDK.init({
            'apiToken': 'your-api-token'
        })
        print('✅ SDK connected successfully!')
    except Exception as e:
        print(f'❌ Connection failed: {e}')

asyncio.run(test_connection())

Dependency Installation Issues

JavaScript Common Issues

"SDK is not supported in browser environments"

  • The JavaScript SDK is Node.js only. For browser applications, consider using our REST API directly.

Python Common Issues

"No module named 'urbansky_sdk'" or "No module named 'centrifuge'"

bash
# Install the required dependencies — the SDK runtime itself comes from the loader
pip install centrifuge-python requests

# Or using a virtual environment (recommended)
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install centrifuge-python requests

"ModuleNotFoundError" with async/await

  • Ensure you're using Python 3.8+ for proper async support

Next Steps

  1. Get an API Token: Follow the Authentication Guide
  2. Try Basic Usage: Check out Basic Usage Examples
  3. Explore Features: See JavaScript SDK or Python SDK

Troubleshooting

Common Installation Issues

"SDK not found" or "UrbanSkySDK is not defined"

  • Check network connectivity to sdk.atmosys.com
  • Verify the loader script executed successfully

"Module not found" (Python)

  • Ensure you're running Python 3.8+
  • Check that the required centrifuge-python dependency is installed in your environment
  • Check that the loader script downloaded correctly and verify file permissions

Getting Help