Appearance
Installation
Quick Start
The Urban Sky SDK is available for JavaScript and Python using our CDN loader system. Choose your preferred language below.
JavaScript/TypeScript
Prerequisites
Before using the JavaScript SDK, install the required dependency:
bash
npm install ablyRequirements:
- Node.js 18+
ably- Real-time messaging
Note: HTTP requests 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
Before using the Python SDK, install the required dependencies:
bash
pip install ably requestsRequirements:
- Python 3.8+
ably- Real-time messagingrequests- HTTP client
Note: While you can use built-in modules, requests is recommended for better reliability.
Using the Loader Script
For Python, use our loader script:
python
import requests
# Load the SDK dynamically
exec(requests.get('https://sdk.atmosys.com/runtime/py/current/loader.py').text)
# SDK is now available as UrbanSkySDK
sdk = await UrbanSkySDK.init({
'apiToken': 'your-api-token'
})Download and Import
Alternatively, download the loader script:
bash
# Download the loader
curl -o urbansky_loader.py https://sdk.atmosys.com/runtime/py/current/loader.py
# Use in your script
python your_script.pypython
# your_script.py
import os
exec(open('urbansky_loader.py').read()) # Loads the SDK
# SDK is now available
sdk = await UrbanSkySDK.init({
'apiToken': os.getenv('URBAN_SKY_API_TOKEN')
})Environment Setup
Environment Variables
Set up your environment variables:
bash
# .env file
URBAN_SKY_API_TOKEN=your-api-token-hereVerification
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
"Cannot find module 'ably'"
bash
# Install the required dependency
npm install ably
# Or if using yarn
yarn add ably"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 'ably'" or "No module named 'requests'"
bash
# Install the required dependencies
pip install ably requests
# Or using a virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install ably requests"ModuleNotFoundError" with async/await
- Ensure you're using Python 3.8+ for proper async support
- The Ably library requires asyncio for real-time functionality
Next Steps
- Get an API Token: Follow the Authentication Guide
- Try Basic Usage: Check out Basic Usage Examples
- 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 loader script downloaded correctly
- Verify file permissions
Getting Help
- Check the Error Handling Guide
- Contact support with installation details