Skip to main content

Python SDK for Premier Padel public sports data APIs.

Project description

Premier Padel Python SDK

Python SDK for Premier Padel data APIs.


Access live scores, player rankings, tournament calendars, match statistics, news, media, and broadcaster data from the Premier Padel APIs making them easily accessible.


Table of Contents


Installation

pip install pypadel

Or with uv:

uv add pypadel

Requires Python 3.10+. The only runtime dependency is httpx.


Quick Start

from pypadel import PremierPadelClient, Gender, ResultsDrawType

with PremierPadelClient() as client:
    # Top-ranked male players
    rankings = client.players.list(Gender.MALE)
    print(rankings[0].full_name)

    # Full player profile
    profile = client.players.get(rankings[0].slug)

    # Tournament calendar
    tournaments = client.tournaments.list("March", 2026)

    # Live match scores
    live = client.matches.live("cancun-p2-2")
    for match in live:
        print(f"{match.team_1.player.name} vs {match.team_2.player.name}")

    # Tournament results
    results = client.tournaments.results(
        "cancun-p2-2", "2026-03-22", ResultsDrawType.WOMEN
    )

Services

The client exposes seven resource-oriented services. Each one has its own detailed documentation:

Service Access Description Docs
Players client.players Rankings, search, profiles, moments docs/players.md
Tournaments client.tournaments Calendar, draws, entrants, results docs/tournaments.md
Matches client.matches Live scores, upcoming, match detail docs/matches.md
News client.news Article listing and detail docs/news.md
Media client.media Videos, reels, video page docs/media.md
Watch client.watch Broadcasters, where-to-watch info docs/watch.md
Rankings client.rankings Convenience alias over player rankings docs/players.md

Every method that accepts a tournament, player, or match identifier is flexible: pass a model instance, an int ID, or a str slug — the SDK resolves it automatically.


Pagination

Paginated endpoints return a Page[T] object:

page = client.players.list(Gender.FEMALE)

# Iterate current page
for player in page:
    print(player.full_name)

# Check metadata
print(page.current_page, page.total_pages, page.has_next_page)

# Fetch next page
next_page = page.next_page()

# Lazy iteration across ALL pages
for player in page.iter_all():
    print(player.full_name)

See docs/pagination.md for the full API.


Error Handling

All exceptions inherit from PremierPadelError:

PremierPadelError
├── NetworkError
│   └── TimeoutError
├── HTTPStatusError
│   └── RateLimitError
├── ApiResponseError
│   └── NotFoundError
└── ValidationError
from pypadel import (
    PremierPadelClient,
    NotFoundError,
    RateLimitError,
    NetworkError,
    PremierPadelError,
)

with PremierPadelClient() as client:
    try:
        player = client.players.get("non-existent-slug")
    except NotFoundError:
        print("Player not found")
    except RateLimitError:
        print("Rate limited — back off and retry")
    except NetworkError:
        print("Could not reach the API")
    except PremierPadelError:
        print("Something else went wrong")

See docs/errors.md for details on each exception type.


Configuration

from pypadel import PremierPadelClient

client = PremierPadelClient(
    lang="es",          # Response language (default: "en")
    timeout=15.0,       # Request timeout in seconds (default: 10.0)
    retries=3,          # Retry count for 5xx / timeout (default: 2)
)
Parameter Type Default Description
lang str "en" Language code for localized responses
timeout float 10.0 HTTP request timeout in seconds
retries int 2 Number of retries on transient failures
base_url str Premier Padel API Override the API base URL
user_agent str pypadel-python/{version} Custom User-Agent header
transport httpx.BaseTransport None Inject a custom httpx transport (useful for testing)

Architecture

src/pypadel/
├── client.py           # PremierPadelClient — public entrypoint
├── config.py           # ClientConfig dataclass
├── enums.py            # Gender, RankingScope, BracketDrawType, ...
├── exceptions.py       # Exception hierarchy
├── pagination.py       # Page[T] generic container
├── transport.py        # HTTP transport, retry logic, envelope parsing
├── models/             # Frozen dataclasses for every API resource
│   ├── common.py       #   Competitor, Statistic, StatisticValue
│   ├── matches.py      #   MatchCard, MatchDetail, LiveMatchDetail, ...
│   ├── players.py      #   PlayerSummary, PlayerDetail, PlayerMoment
│   ├── tournaments.py  #   Tournament, TournamentDraw, TournamentResults, ...
│   ├── news.py         #   NewsArticleSummary, NewsArticle
│   ├── media.py        #   Video, ShortReel, VideoPage, ...
│   └── watch.py        #   Broadcaster, CountryBroadcasters, WatchInfo, ...
├── parsers/            # Defensive JSON → model normalization
│   ├── common.py       #   Shared helpers (optional_str, optional_int, ...)
│   ├── matches.py
│   ├── players.py
│   ├── tournaments.py
│   ├── news.py
│   ├── media.py
│   └── watch.py
└── services/           # Resource-oriented service layer
    ├── base.py         #   BaseService with resolver helpers
    ├── matches.py
    ├── players.py
    ├── tournaments.py
    ├── news.py
    ├── media.py
    ├── rankings.py
    └── watch.py

The design follows a strict layered pattern:

  1. Transport — Handles HTTP, retries, rate-limit detection, and envelope parsing
  2. Parsers — Normalize raw JSON into typed dataclasses defensively
  3. Services — Orchestrate transport calls, argument resolution, and caching
  4. Client — Wires services together and manages the in-memory cache

Examples

See the examples/ directory for runnable scripts:

File Description
live_scores.py Stream live match scores for a tournament
player_search.py Search and display player profiles
tournament_results.py Fetch and print tournament results

License

MIT — see LICENSE for details.


Disclaimer

This is an unofficial, community-maintained SDK.

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

pypadel-0.1.0.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

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

pypadel-0.1.0-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

File details

Details for the file pypadel-0.1.0.tar.gz.

File metadata

  • Download URL: pypadel-0.1.0.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for pypadel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bb693263da3f0318a3052ad0d8c2af482b720dbd45fec983e0a49d7482f77978
MD5 dba7072cf796c5de027badef85989107
BLAKE2b-256 8bab22c004c64de0ff7079c5e4464c90b525b3cfdab69ebe7f083b072e069ee9

See more details on using hashes here.

File details

Details for the file pypadel-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pypadel-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 35.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for pypadel-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9997d132789b5a43f062540192a6594d7ddc0242db069721e8e190cbb6328c87
MD5 edd92026f3a8b456408b5fe9b26bd057
BLAKE2b-256 3128abe80d17b99812c96a11e47f75ae786d2b5a3e0ca9aebf371c5e98d9c88e

See more details on using hashes here.

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