Skip to main content

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 standings
  • client.v1.games - Box scores
  • client.v1.players - Player stats
  • client.v1.teams - Team rosters

V2 Endpoints

  • client.v2.clubs - Club information
  • client.v2.games - Game details and history
  • client.v2.people - Players, coaches, personnel
  • client.v2.seasons - Season information
  • client.v2.standings - Detailed standings

V3 Endpoints (Recommended for Analytics)

  • client.v3.player_stats - Leaders, traditional, advanced, scoring stats
  • client.v3.team_stats - Traditional, advanced, opponent stats
  • client.v3.standings - Basic, streaks, margins, calendar views
  • client.v3.stats - Game stats, team comparisons

Competition Codes

  • E - EuroLeague
  • U - 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_euroleague-0.1.0.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_euroleague-0.1.0-py3-none-any.whl (40.7 kB view details)

Uploaded Python 3

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

Hashes for py_euroleague-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d0464673e20bbd6ca152b1046ac15bced226125c3bc5ea29b8104c1a9472d438
MD5 ab16c51e4a7990f14ca2e180bad78af9
BLAKE2b-256 7fa2dd5e42851a9c3e586382efae11a1d6018bca61d942f1d305616d60e3aeec

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_euroleague-0.1.0.tar.gz:

Publisher: release.yml on sfendourakis/py-euroleague

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for py_euroleague-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e3b866cd20ce5546035a931a8104394d889cfb906c927080378214abdb17d73e
MD5 b4427f645156b46facbe9e43284b866a
BLAKE2b-256 ad962823683c4fb44524c5a17725cf3a54384da0f4444f183e7616805b124c83

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_euroleague-0.1.0-py3-none-any.whl:

Publisher: release.yml on sfendourakis/py-euroleague

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page