#!/usr/bin/env python3
import requests
import os
api_key = os.getenv("CFB_API_KEY", "TxRscdpH1jqc9rw177qrD4ZAObJDDaEuW8Hh6fczeRgL8I4sEx6YsliBILnpWnrm")
url = "https://api.collegefootballdata.com/games"
headers = {"Authorization": f"Bearer {api_key}", "Accept": "application/json"}
# Test with Alabama
params = {"team": "Alabama", "year": 2024, "seasonType": "both"}
print(f"Testing: {params}")
response = requests.get(url, headers=headers, params=params, timeout=10)
print(f"Status: {response.status_code}")
if response.status_code == 200:
data = response.json()
print(f"Got {len(data)} games")
if len(data) > 0:
print(f"First game: {data[0]}")
else:
print(f"Error: {response.text}")