Add complete Nike football data platform with: - FastMCP server exposing football data tools over HTTP - RapidAPI client for free-api-live-football-data integration - Bootstrap web dashboard with live match/standings views - REST API endpoints for dashboard consumption - Docker support with multi-stage build - Comprehensive README with architecture docs - Minimal .gitignore replacing verbose Python template
37 lines
979 B
Python
37 lines
979 B
Python
#!/usr/bin/env python3
|
|
"""Test connection to Portia PostgreSQL."""
|
|
import os
|
|
import sys
|
|
import time
|
|
|
|
from dotenv import load_dotenv
|
|
import psycopg2
|
|
|
|
load_dotenv('/home/robert/gitea/nike/.env')
|
|
|
|
try:
|
|
t0 = time.time()
|
|
conn = psycopg2.connect(
|
|
host=os.getenv('DB_HOST'),
|
|
port=int(os.getenv('DB_PORT', 5432)),
|
|
user=os.getenv('DB_USER'),
|
|
password=os.getenv('DB_PASSWORD'),
|
|
dbname='nike',
|
|
connect_timeout=5,
|
|
)
|
|
latency_ms = round((time.time() - t0) * 1000, 1)
|
|
cur = conn.cursor()
|
|
cur.execute('SELECT version();')
|
|
version = cur.fetchone()[0]
|
|
cur.execute("SELECT current_database(), current_user;")
|
|
db, user = cur.fetchone()
|
|
cur.close()
|
|
conn.close()
|
|
print(f"✅ Connected in {latency_ms}ms")
|
|
print(f" Database : {db}")
|
|
print(f" User : {user}")
|
|
print(f" Version : {version.split(',')[0]}")
|
|
except Exception as e:
|
|
print(f"❌ Connection failed: {e}")
|
|
sys.exit(1)
|