*injury status
This commit is contained in:
parent
10f8e07ed4
commit
b6fac28396
1 changed files with 27 additions and 0 deletions
|
|
@ -8,6 +8,33 @@ class ESPNAPI:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.session = requests.Session()
|
self.session = requests.Session()
|
||||||
|
|
||||||
|
def get_player_injury_status(self, player_name):
|
||||||
|
"""Get injury status for a specific player from ESPN"""
|
||||||
|
try:
|
||||||
|
# Try to get player info from ESPN API
|
||||||
|
url = f"{self.BASE_URL}/athletes"
|
||||||
|
response = self.session.get(url, params={'search': player_name})
|
||||||
|
response.raise_for_status()
|
||||||
|
data = response.json()
|
||||||
|
|
||||||
|
print(f"ESPN API: Searching for {player_name}", flush=True)
|
||||||
|
|
||||||
|
if 'athletes' in data and len(data['athletes']) > 0:
|
||||||
|
athlete = data['athletes'][0]
|
||||||
|
print(f"ESPN API: Found athlete data for {player_name}: {athlete}", flush=True)
|
||||||
|
|
||||||
|
# Check for injury status
|
||||||
|
if 'injuries' in athlete:
|
||||||
|
return athlete['injuries']
|
||||||
|
elif 'status' in athlete:
|
||||||
|
return athlete['status']
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"ESPN API: Error fetching injury status for {player_name}: {e}", flush=True)
|
||||||
|
return None
|
||||||
|
|
||||||
def get_week_schedule(self, week, season, user_timezone='America/Los_Angeles'):
|
def get_week_schedule(self, week, season, user_timezone='America/Los_Angeles'):
|
||||||
"""Get NFL schedule for a specific week"""
|
"""Get NFL schedule for a specific week"""
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue