bug today
This commit is contained in:
parent
faf6ec0c35
commit
4dc5539da2
5 changed files with 189 additions and 38 deletions
|
|
@ -37,19 +37,31 @@ class LichessAPI:
|
|||
|
||||
async def get_today_stats(self, username: str) -> Optional[Dict[str, Any]]:
|
||||
"""Get today's statistics from our stats API"""
|
||||
logger.info(f"🔍 LichessAPI.get_today_stats: username={username}, stats_base_url={self.stats_base_url}")
|
||||
await self.rate_limiter.wait_if_needed()
|
||||
url = f"{self.stats_base_url}/stats/{username}/today"
|
||||
logger.info(f"🔍 Making request to: {url}")
|
||||
try:
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get(
|
||||
f"{self.stats_base_url}/stats/{username}/today"
|
||||
) as response:
|
||||
async with session.get(url) as response:
|
||||
logger.info(f"🔍 Response status: {response.status} for {username}")
|
||||
if response.status == 200:
|
||||
return await response.json()
|
||||
result = await response.json()
|
||||
logger.info(f"🔍 Successfully got stats for {username}: {result.get('message', 'no message')}")
|
||||
return result
|
||||
else:
|
||||
logger.error(f"Failed to get today stats: {response.status}")
|
||||
error_text = await response.text()
|
||||
logger.error(f"❌ Failed to get today stats for {username}: status={response.status}, error={error_text[:200]}")
|
||||
return None
|
||||
except aiohttp.ClientError as e:
|
||||
logger.error(f"❌ Client error getting today stats for {username}: {e}")
|
||||
import traceback
|
||||
logger.error(traceback.format_exc())
|
||||
return None
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting today stats: {e}")
|
||||
logger.error(f"❌ Error getting today stats for {username}: {e}")
|
||||
import traceback
|
||||
logger.error(traceback.format_exc())
|
||||
return None
|
||||
|
||||
async def get_yesterday_stats(self, username: str) -> Optional[Dict[str, Any]]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue