#!/usr/bin/env python3 """ Quick test script to verify server connectivity """ import requests import socketio def test_http_connection(): """Test basic HTTP connection""" try: response = requests.get('http://localhost:5140/api/test-spotify', timeout=5) print(f"✅ HTTP connection successful: {response.status_code}") return True except requests.exceptions.ConnectionError: print("❌ HTTP connection failed - server not running") return False except Exception as e: print(f"❌ HTTP connection error: {e}") return False def test_socket_connection(): """Test SocketIO connection""" try: sio = socketio.Client() @sio.event def connect(): print("✅ SocketIO connected successfully") sio.disconnect() @sio.event def connect_error(data): print(f"❌ SocketIO connection error: {data}") sio.connect('http://localhost:5140', wait_timeout=5) return True except Exception as e: print(f"❌ SocketIO connection failed: {e}") return False if __name__ == '__main__': print("🔍 Testing server connectivity...") print("\n1. Testing HTTP connection:") http_ok = test_http_connection() print("\n2. Testing SocketIO connection:") socket_ok = test_socket_connection() print(f"\n📊 Results:") print(f"HTTP: {'✅ OK' if http_ok else '❌ FAILED'}") print(f"SocketIO: {'✅ OK' if socket_ok else '❌ FAILED'}") if not http_ok: print("\n💡 Suggestions:") print("- Make sure the server is running: python server/app.py") print("- Check if port 5140 is available") print("- Install missing dependencies: pip install -r server/requirements.txt")