Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/base_classes/data_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,16 @@ def fetch_standings(self, sport: str, league: str) -> Dict:
"""Fetch standings for a sport/league."""

def get_headers(self) -> Dict[str, str]:
"""Get headers for API requests."""
"""Get headers for API requests.

The agent carries the project URL deliberately. Around 2026-08-04 ESPN
began returning 403 for bare custom tokens like 'LEDMatrix/1.0' — and
for browser-style strings — while accepting an agent that identifies
the client and links to it. An Accept header alone does not rescue the
bare form when the request goes out through requests.
"""
return {
'User-Agent': 'LEDMatrix/1.0',
'User-Agent': 'LEDMatrix/1.0 (+https://github.com/ChuckBuilds/LEDMatrix)',
'Accept': 'application/json'
}

Expand Down
4 changes: 3 additions & 1 deletion src/common/api_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def __init__(self, cache_manager=None, default_timeout: int = 30,

# Default headers
self.session.headers.update({
'User-Agent': 'LEDMatrix-Common/1.0',
# Identifies the client and links to it: ESPN began 403ing bare
# custom tokens (and browser strings) around 2026-08-04.
'User-Agent': 'LEDMatrix/1.0 (+https://github.com/ChuckBuilds/LEDMatrix)',
'Accept': 'application/json',
'Accept-Language': 'en-US,en;q=0.9',
'Accept-Encoding': 'gzip, deflate, br',
Expand Down
Loading