Python wrapper for the Euroleague Basketball API
Project description
py-euroleague
A Python wrapper for the Euroleague Basketball API. Access game statistics, player performance, team analytics, standings, and more.
Installation
pip install py-euroleague
Quick Start
from euroleague import EuroleagueClient
client = EuroleagueClient()
# Get current season standings
standings = client.v3.standings.basic("E", "E2025", round_number=20)
# Get top scorers
leaders = client.v3.player_stats.leaders("E", season_code="E2025", limit=10)
for player in leaders["points"][:5]:
name = player["details"]["name"]
ppg = player["average"]
print(f"{name}: {ppg:.1f} PPG")
client.close()
Or use as a context manager:
with EuroleagueClient() as client:
clubs = client.v2.clubs.list(limit=10)
print(f"Found {len(clubs['data'])} clubs")
Statistics & Analytics
Player Statistics
with EuroleagueClient() as client:
# Season leaders across all categories
leaders = client.v3.player_stats.leaders(
competition_code="E",
season_code="E2025",
limit=20
)
# Access different stat categories
top_scorers = leaders["points"]
top_rebounders = leaders["rebounds"]
top_playmakers = leaders["assists"]
top_pir = leaders["pir"] # Performance Index Rating
# Traditional stats (per-game averages)
traditional = client.v3.player_stats.traditional(
competition_code="E",
season_code="E2025"
)
# Advanced analytics
advanced = client.v3.player_stats.advanced(
competition_code="E",
season_code="E2025"
)
Team Statistics
with EuroleagueClient() as client:
# Team traditional stats
team_stats = client.v3.team_stats.traditional(
competition_code="E",
season_code="E2025"
)
for team in team_stats["teams"][:5]:
name = team["team"]["name"]
ppg = team["pointsScored"]
print(f"{name}: {ppg:.1f} PPG")
# Team advanced stats
advanced = client.v3.team_stats.advanced(
competition_code="E",
season_code="E2025"
)
# Opponent stats (defensive analysis)
opponent_stats = client.v3.team_stats.opponents(
competition_code="E",
season_code="E2025"
)
Game Box Scores
with EuroleagueClient() as client:
# Get game stats with full box score
game_stats = client.v3.stats.get_game_stats("E", "E2025", game_code=100)
# Home team stats
home = game_stats["local"]
home_total = home["total"]
print(f"Home: {home_total['points']} points")
# Individual player stats
for player in home["players"]:
name = player["player"]["person"]["name"]
pts = player["stats"]["points"]
reb = player["stats"]["totalRebounds"]
ast = player["stats"]["assistances"]
print(f" {name}: {pts} PTS, {reb} REB, {ast} AST")
Standings & Rankings
with EuroleagueClient() as client:
# Current standings
standings = client.v3.standings.basic("E", "E2025", round_number=20)
# Streak analysis
streaks = client.v3.standings.streaks("E", "E2025", round_number=20)
# Point differential margins
margins = client.v3.standings.margins("E", "E2025", round_number=20)
Async Support
For better performance with multiple requests:
import asyncio
from euroleague import AsyncEuroleagueClient
async def analyze_season():
async with AsyncEuroleagueClient() as client:
# Parallel requests
leaders, team_stats, standings = await asyncio.gather(
client.v3.player_stats.leaders_async("E", season_code="E2025"),
client.v3.team_stats.traditional_async("E", season_code="E2025"),
client.v3.standings.basic_async("E", "E2025", 20)
)
return leaders, team_stats, standings
asyncio.run(analyze_season())
API Versions
The Euroleague API has three versions, each with different focuses:
| Version | Focus | Best For |
|---|---|---|
| V1 | Legacy/Simple | Basic box scores, standings |
| V2 | Comprehensive | Clubs, games, people, seasons |
| V3 | Statistics | Player/team stats, analytics |
V1 Endpoints
client.v1.standings- League standingsclient.v1.games- Box scoresclient.v1.players- Player statsclient.v1.teams- Team rosters
V2 Endpoints
client.v2.clubs- Club informationclient.v2.games- Game details and historyclient.v2.people- Players, coaches, personnelclient.v2.seasons- Season informationclient.v2.standings- Detailed standings
V3 Endpoints (Recommended for Analytics)
client.v3.player_stats- Leaders, traditional, advanced, scoring statsclient.v3.team_stats- Traditional, advanced, opponent statsclient.v3.standings- Basic, streaks, margins, calendar viewsclient.v3.stats- Game stats, team comparisons
Competition Codes
E- EuroLeagueU- EuroCup
Examples
See the examples/ directory for complete working examples:
- basic_usage.py - Getting started with the API
- player_analysis.py - Player statistics and comparisons
- team_analysis.py - Team performance analysis
- game_analysis.py - Game results and box scores
- player_game_logs.py - Game-by-game player statistics
- fantasy_basketball.py - Fantasy basketball analysis
- async_example.py - Async client usage
Error Handling
from euroleague import EuroleagueClient
from euroleague.exceptions import NotFoundError, RateLimitError, APIError
with EuroleagueClient() as client:
try:
player = client.v2.people.get("INVALID_CODE")
except NotFoundError:
print("Player not found")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after}s")
except APIError as e:
print(f"API error: {e.message}")
License
MIT License - see LICENSE file for details.
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_euroleague-0.1.0.tar.gz.
File metadata
- Download URL: py_euroleague-0.1.0.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0464673e20bbd6ca152b1046ac15bced226125c3bc5ea29b8104c1a9472d438
|
|
| MD5 |
ab16c51e4a7990f14ca2e180bad78af9
|
|
| BLAKE2b-256 |
7fa2dd5e42851a9c3e586382efae11a1d6018bca61d942f1d305616d60e3aeec
|
Provenance
The following attestation bundles were made for py_euroleague-0.1.0.tar.gz:
Publisher:
release.yml on sfendourakis/py-euroleague
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_euroleague-0.1.0.tar.gz -
Subject digest:
d0464673e20bbd6ca152b1046ac15bced226125c3bc5ea29b8104c1a9472d438 - Sigstore transparency entry: 867976717
- Sigstore integration time:
-
Permalink:
sfendourakis/py-euroleague@58a218578e6d4de96e6e2e5c91db5fba22c35aab -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/sfendourakis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@58a218578e6d4de96e6e2e5c91db5fba22c35aab -
Trigger Event:
push
-
Statement type:
File details
Details for the file py_euroleague-0.1.0-py3-none-any.whl.
File metadata
- Download URL: py_euroleague-0.1.0-py3-none-any.whl
- Upload date:
- Size: 40.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3b866cd20ce5546035a931a8104394d889cfb906c927080378214abdb17d73e
|
|
| MD5 |
b4427f645156b46facbe9e43284b866a
|
|
| BLAKE2b-256 |
ad962823683c4fb44524c5a17725cf3a54384da0f4444f183e7616805b124c83
|
Provenance
The following attestation bundles were made for py_euroleague-0.1.0-py3-none-any.whl:
Publisher:
release.yml on sfendourakis/py-euroleague
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_euroleague-0.1.0-py3-none-any.whl -
Subject digest:
e3b866cd20ce5546035a931a8104394d889cfb906c927080378214abdb17d73e - Sigstore transparency entry: 867976739
- Sigstore integration time:
-
Permalink:
sfendourakis/py-euroleague@58a218578e6d4de96e6e2e5c91db5fba22c35aab -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/sfendourakis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@58a218578e6d4de96e6e2e5c91db5fba22c35aab -
Trigger Event:
push
-
Statement type: