Using Flow with Opta Data#

Flow includes a built-in integration with the Stats Perform (Opta) API, making it easy to stream structured football data directly into your pipelines.

Rather than loading everything upfront, Flow wraps the API as lazy operations - each call builds a plan that fetches the data only when needed (e.g., on .collect() or .to_pandas()).

⚙️ Setup#

Ensure your Opta credentials are set as environment variables:

export OPTA_AUTH_KEY="your_auth_key"
export OPTA_RT_MODE="b"

🚀 Getting Started#

from penaltyblog.matchflow.contrib import opta

# Fetch all areas
areas = opta.areas()

for area in areas.head(3):
    print(area)

All API calls return a Flow, so you can apply all usual transformations like .filter(), .select(), .assign(), etc.

🔍 Available Endpoints#

Available Opta API Endpoints#

Method

Feed ID

Description

.tournament_calendars(...)

OT2

All tournament calendars available via API

.venues(...)

OT3

All venues available via API

.areas([area_uuid])

OT4

All areas available via API

.tournament_schedule(tournament_calendar_uuid, ...)

MA0

Matches for a specific season

.matches(...)

MA1

All matches available via API

.match(fixture_uuid, ...)

MA1

A single match

.match_stats_player(fixture_uuids, ...)

MA2

Player-level stats for a match

.match_stats_team(fixture_uuids, ...)

MA2

Team-level stats for a match

.events(fixture_uuid, ...)

MA3

All events in a match

.pass_matrix(fixture_uuid, ...)

MA4

Pass matrix and average formation data

.possession(fixture_uuid, ...)

MA5

Possession and territorial advantage data

.player_career(...)

PE2

Player career data

.referees(...)

PE3

All referees available via API

.rankings(tournament_calendar_uuid, ...)

PE4

Rankings data for players, teams, and games

.injuries(...)

PE7

All injuries available via API

.teams(...)

TM1

All teams available via API

.team_standings(tournament_calendar_uuid, ...)

TM2

League table and standings data with multiple division types (total, home, away, form, half-time, etc.)

.squads(...)

TM3

All squads available via API

.player_season_stats(tmcl_uuid, ctst_uuid, ...)

TM4

Player stats over a season

.team_season_stats(tmcl_uuid, ctst_uuid, ...)

TM4

Team stats over a season

.transfers(...)

TM7

Player transfer data

.contestant_participation(contestant_uuid, ...)

TM16

Contestant participation data

All of these return a lazy Flow

📋 Parameter Validation & Constraints#

Some methods have specific validation rules and parameter constraints:

Required Parameters

  • venues(): At least one of tournament_calendar_uuid, contestant_uuid, or venue_uuid must be provided

  • matches(): Both date_from and date_to must be provided together (if using date filtering)

  • referees(): Exactly one of person_uuid, tournament_calendar_uuid, or stage_uuid must be provided

  • teams(): Either tournament_calendar_uuid or contestant_uuid must be provided

  • squads(): Either tournament_calendar_uuid or contestant_uuid must be provided

  • player_career(): Exactly one of person_uuid or contestant_uuid must be provided

  • injuries(): Either person_uuid or tournament_calendar_uuid must be provided

  • transfers(): At least one of person_uuid, contestant_uuid, competition_uuid, or tournament_calendar_uuid must be provided

Date Parameter Constraints

  • matches(): When using date_from/date_to, they must be valid dates and date_from cannot be after date_to

  • transfers(): When using start_date/end_date, competition_uuid must be provided and tournament_calendar_uuid cannot be used

Common Parameter Types

  • fixture_uuids: Accepts str or List[str] (for match stats methods)

  • event_types: Accepts int or List[int] (for events method)

  • coverage_level: Accepts int or List[int] (for tournament_schedule method)

  • contestant_uuid: Accepts str or List[str] (for contestant_participation method)

Optional Parameters

  • use_opta_names: Available on most methods (default: False) - Requests ‘en-op’ locale for Opta-specific names

  • creds: Dictionary with auth_key and rt_mode (or use environment variables)

  • proxies: Dictionary for proxy configuration (e.g., {'http': 'socks5h://localhost:9090'})

  • optimize: Boolean to optimize execution plan (default: False)

🧪 Example: Referees in a Tournament#

from penaltyblog.matchflow.contrib import opta

referees = (
    opta.referees(tournament_calendar_uuid="51r6ph2woavlbbpk8f29nynf8")
    .select("firstName", "lastName", "nationality")
)

for referee in referees.head(3):
    print(referee)

🧪 Example: Using Opta-Specific Names#

from penaltyblog.matchflow.contrib import opta

# Get team standings with Opta-specific names
standings = (
    opta.team_standings(
        tournament_calendar_uuid="51r6ph2woavlbbpk8f29nynf8",
        type="total",
        use_opta_names=True
    )
)

🧪 Example: Multiple Fixture UUIDs#

from penaltyblog.matchflow.contrib import opta

# Get player stats for multiple matches
player_stats = (
    opta.match_stats_player(
        fixture_uuids=["match1_uuid", "match2_uuid", "match3_uuid"],
        use_opta_names=True
    )
)

🧼 Filtering & Transforming#

Because Flow supports deep access to nested fields, you can work directly with Opta’s JSON structure without needing to flatten first:

from penaltyblog.matchflow.contrib import opta

english_referees = (
    opta.referees(tournament_calendar_uuid="51r6ph2woavlbbpk8f29nynf8")
    .filter(lambda r: r["nationality"] == "England")
    .select("firstName", "lastName")
)

🐢 Lazy Until Needed#

Remember, nothing is downloaded or processed until you materialize the flow:

  • .collect() → fetches all records

  • .to_pandas() → fetches and converts to DataFrame

  • .head(n) → fetches just the first n records

df = opta.areas().to_pandas()
print(df)

🔒 Authenticated Access#

All API methods accept a creds dictionary, or you can use environment variables. They also accept a proxies argument for routing requests through a proxy.

proxies = {
    'http': 'socks5h://localhost:9090',
    'https': 'socks5h://localhost:9090'
}

data = opta.tournament_calendars(
    status="all",
    proxies=proxies
).collect()
opta.referees(tournament_calendar_uuid="51r6ph2woavlbbpk8f29nynf8", creds={"auth_key": "...", "rt_mode": "..."})

🧠 Tips#

  • Cloud Ready: You can stream data directly to cloud storage without downloading it locally first: opta.events(...).to_jsonl("s3://my-bucket/events.jsonl")

  • Integration: Useful for clubs or analysts already using Opta data who want to join it with internal data.

  • Exporting: Try .flatten().to_jsonl() to export clean, flat

📝 Summary#

Flow’s Opta integration:

  • ✅ Keeps your data structured

  • ✅ Streams on demand (not loaded eagerly)

  • ✅ Integrates with full Flow pipeline tools

  • ✅ Works with both open and authenticated endpoints

💁 Opta Helpers#

The penaltyblog.matchflow.opta_helpers module provides helper functions to simplify common filtering tasks when working with Opta event data. These helpers allow you to filter by human-readable names instead of remembering specific Opta ID codes.

Filtering by Event Type#

Use where_opta_event() to filter events by their name, like “Pass” or “Shot”. The helper automatically looks up the correct typeId.

from penaltyblog.matchflow.contrib import opta
from penaltyblog.matchflow.opta_helpers import where_opta_event

# Get all shots for a match
shots = (
    opta.events(fixture_uuid="some_match_id")
    .filter(where_opta_event("Shot"))
)

# You can also filter for multiple event types
passes_and_shots = (
    opta.events(fixture_uuid="some_match_id")
    .filter(where_opta_event(["Pass", "Shot"]))
)

Filtering by Qualifier#

Use where_opta_qualifier() to filter events that have a specific qualifier. You can check for the presence of a qualifier or for a qualifier with a specific value.

Checking for Presence

from penaltyblog.matchflow.contrib import opta
from penaltyblog.matchflow.opta_helpers import where_opta_qualifier

# Get all penalty shots
penalty_shots = (
    opta.events(fixture_uuid="some_match_id")
    .filter(where_opta_event("Shot"))
    .filter(where_opta_qualifier("Penalty"))
)

Checking for a Specific Value

from penaltyblog.matchflow.contrib import opta
from penaltyblog.matchflow.opta_helpers import where_opta_qualifier

# Get all shots from the "Danger Zone"
danger_zone_shots = (
    opta.events(fixture_uuid="some_match_id")
    .filter(where_opta_event("Shot"))
    .filter(where_opta_qualifier("Zone", "Danger Zone"))
)

Exploring Available Mappings#

To see all available event and qualifier names that you can use with the helpers, use the get_opta_mappings() function.

from penaltyblog.matchflow.opta_helpers import get_opta_mappings

mappings = get_opta_mappings()

print("Available Event Types:")
for event in mappings["events"]:
    print(f"  ID: {event['id']:3d} | Name: {event['name']}")

print("\nAvailable Qualifier Types:")
for qualifier in mappings["qualifiers"]:
    print(f"  ID: {qualifier['id']:3d} | Name: {qualifier['name']}")

This will return a dictionary containing all event and qualifier names and their corresponding IDs. The mappings include comprehensive football event data such as:

Key Event Types: - Pass (1), Offside Pass (2), Take On (3), Foul (4) - Save (10), Clearance (12), Miss (13), Post (14), Attempt Saved (15), Goal (16) - Card (17), Substitutions (18, 19), Interception (8), Tackle (7) - And many more specialized events (80+ total event types)

Key Qualifier Types: - Long Ball (1), Cross (2), Head Pass (3), Through Ball (4) - Penalty (9), Handball (10), Various card types (31-33) - Pitch zones (e.g. Small box - Centre (16), Box - Right (63)) - Shot locations (76-87), Save types (173-183), VAR-related qualifiers (329-336) - And hundreds of detailed qualifiers for specific situations

The helper functions automatically handle the case-insensitive lookup, so you can use human-readable names like “Shot”, “Pass”, “Penalty”, “Zone” etc. in your filters without needing to remember the specific Opta IDs.

🔍 Endpoint Arguments#

class penaltyblog.matchflow.contrib.opta.Opta[source]#

Bases: object

A lazy Flow builder for the Stats Perform (Opta) Soccer API.

This class provides methods that correspond to specific Opta feeds. Calling a method returns a Flow object that, when executed, will make the necessary API requests to fetch the data.

Supported Feeds (in order): - OT2 (Tournament Calendars): .tournament_calendars() - OT3 (Venues): .venues() - OT4 (Areas): .areas() - MA0 (Tournament Schedule): .tournament_schedule() - MA1 (Match - Basic): .matches() / .match() - MA2 (Match Stats - Basic): .match_player_stats() / .match_team_stats() - MA3 (Match Events): .events() - MA4 (Pass Matrix): .pass_matrix() - MA5 (Possession): .possession() - PE2 (Player Career): .player_career() - PE3 (Referees): .referees() - PE4 (Rankings): .rankings() - PE7 (Injuries): .injuries() - TM1 (Teams): .teams() - TM2 (Team Standings): .team_standings() - TM3 (Squads): .squads() - TM4 (Season Stats): .player_season_stats() / .team_season_stats() - TM7 (Transfers): .transfers() - TM16 (Contestant Part.): .contestant_participation()

property ASSET_TYPE: str#

Get asset type (constant for now).

property BASE_URL: str#

Get base URL from environment variables.

property DEFAULT_CREDS: dict#

Get default credentials from environment variables.

areas(area_uuid: str | None = None, use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw area data (Feed OT4).

If ‘area_uuid’ is provided, fetches data for a specific area. If ‘area_uuid’ is None, fetches a paginated list of all areas.

Parameters:
  • area_uuid (str, optional) – The UUID for a specific area.

  • use_opta_names (bool, optional) – Request ‘en-op’ locale for Opta-specific names (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw area data.

Return type:

Flow

contestant_participation(contestant_uuid: str | None = None, active: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of contestant participation data (Feed TM16). Provides a list of competitions and tournament calendars for a team. This feed is paginated.

Parameters:
  • contestant_uuid (str or List[str]) – The UUID(s) for the specific contestant(s) (team). Can be a single UUID, list of UUIDs, or an Opta ID.

  • active (bool, optional) – Filter for active tournament calendars only (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw competition/tournament calendar data.

Return type:

Flow

Raises:

ValueError – If ‘contestant_uuid’ is not provided.

events(fixture_uuid: str, contestant_uuid: str | None = None, person_uuid: str | None = None, event_types: int | List[int] | None = None, use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw match events data (Feed MA3).

Parameters:
  • fixture_uuid (str) – The UUID for the specific match/fixture.

  • contestant_uuid (str, optional) – Filter by a specific contestant (team) UUID.

  • person_uuid (str, optional) – Filter by a specific person (player) UUID.

  • event_types (int or List[int], optional) – Filter by event type(s). Can be a single integer or list of integers.

  • use_opta_names (bool, optional) – Request ‘en-op’ locale for Opta-specific names (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw match events data.

Return type:

Flow

injuries(person_uuid: str | None = None, tournament_calendar_uuid: str | None = None, contestant_uuid: str | None = None, use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw player injury data (Feed PE7).

Fetches by person (non-paginated) or by tournament calendar (paginated). You must specify ‘person_uuid’ OR ‘tournament_calendar_uuid’. ‘contestant_uuid’ can only be used in combination with ‘tournament_calendar_uuid’.

Parameters:
  • person_uuid (str, optional) – Filter by a specific person UUID. Can be used as the primary filter (path parameter) or with ‘tournament_calendar_uuid’ (query parameter).

  • tournament_calendar_uuid (str, optional) – Filter by a specific tournament calendar UUID.

  • contestant_uuid (str, optional) – Filter by a specific contestant (team) UUID. Must be used with ‘tournament_calendar_uuid’.

  • use_opta_names (bool, optional) – Request ‘en-op’ locale for Opta-specific names (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw injury data.

Return type:

Flow

Raises:

ValueError – If parameter combinations are invalid (e.g., no args, ‘ctst’ without ‘tmcl’, or ‘person_uuid’ and ‘contestant_uuid’ together).

match(fixture_uuid: str, live: bool = False, lineups: bool = False, use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw data for a single match (Feed MA1 - Basic).

Parameters:
  • fixture_uuid (str) – The UUID for the specific match/fixture.

  • live (bool, optional) – Request live data (default: False).

  • lineups (bool, optional) – Request lineup data (requires live=True) (default: False).

  • use_opta_names (bool, optional) – Request ‘en-op’ locale for Opta-specific names (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw match data for the specified fixture.

Return type:

Flow

match_stats_player(fixture_uuids: str | List[str], use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw player match stats data (Feed MA2 - Basic).

Parameters:
  • fixture_uuids (str or List[str]) – The UUID(s) for the specific match/fixture(es). Can be a single UUID or list of UUIDs.

  • use_opta_names (bool, optional) – Request ‘en-op’ locale for Opta-specific names (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw player match statistics data.

Return type:

Flow

match_stats_team(fixture_uuids: str | List[str], use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw team match stats data (Feed MA2 - Basic).

Parameters:
  • fixture_uuids (str or List[str]) – The UUID(s) for the specific match/fixture(es). Can be a single UUID or list of UUIDs.

  • use_opta_names (bool, optional) – Request ‘en-op’ locale for Opta-specific names (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw team match statistics data.

Return type:

Flow

matches(fixture_uuids: List[str] | None = None, tournament_calendar_uuid: str | None = None, competition_uuids: List[str] | None = None, contestant_uuid: str | None = None, opponent_uuid: str | None = None, contestant_position: Literal['home', 'away'] | None = None, date_from: str | datetime | date | None = None, date_to: str | datetime | date | None = None, delta_timestamp: str | datetime | date | None = None, live: bool = True, lineups: bool = False, use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw match data (Feed MA1 - Basic). This feed is paginated. Yields one raw JSON object per page.

Parameters:
  • fixture_uuids (List[str], optional) – Get specific matches by UUID (comma-separated).

  • tournament_calendar_uuid (str, optional) – Filter by tournament calendar.

  • competition_uuids (List[str], optional) – Filter by competition(s) (comma-separated).

  • contestant_uuid (str, optional) – Filter by a specific contestant (team).

  • opponent_uuid (str, optional) – Filter for matches where contestant_uuid played opponent_uuid (maps to ctst2).

  • contestant_position (Literal["home", "away"], optional) – Filter for matches where contestant_uuid played home or away.

  • date_from (str, datetime, or date, optional) – Start of date range.

  • date_to (str, datetime, or date, optional) – End of date range.

  • delta_timestamp (str, datetime, or date, optional) – Get updates since this time.

  • live (bool, optional) – Request live data (default: False).

  • lineups (bool, optional) – Request lineup data (requires live=True) (default: False).

  • use_opta_names (bool, optional) – Request ‘en-op’ locale (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’})

  • optimize (bool, optional) – Whether to optimize the plan.

Returns:

A Flow yielding raw JSON data per page.

Return type:

Flow

pass_matrix(fixture_uuid: str, use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw pass matrix and average formation data (Feed MA4).

Provides information on the number of completed passes between all player combinations and x/y coordinates of their average pitch positions during the match.

Parameters:
  • fixture_uuid (str) – The UUID for the specific match/fixture.

  • use_opta_names (bool, optional) – Request ‘en-op’ locale for Opta-specific names (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw pass matrix and average formation data.

Return type:

Flow

Raises:

ValueError – If ‘fixture_uuid’ is not provided.

player_career(person_uuid: str | None = None, contestant_uuid: str | None = None, active: bool = True, use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw player career data (Feed PE2).

Fetches by person (non-paginated) or contestant (paginated). You must specify exactly one of ‘person_uuid’ or ‘contestant_uuid’.

Parameters:
  • person_uuid (str, optional) – Filter by a specific person UUID.

  • contestant_uuid (str, optional) – Filter by a specific contestant (team) UUID.

  • active (bool, optional) – When using ‘contestant_uuid’, filter for active players (default: True). Ignored for ‘person_uuid’.

  • use_opta_names (bool, optional) – Request ‘en-op’ locale for Opta-specific names (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw player career data.

Return type:

Flow

Raises:

ValueError – If neither or both ‘person_uuid’ and ‘contestant_uuid’ are provided.

player_season_stats(tournament_calendar_uuid: str, contestant_uuid: str, detailed: bool = True, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of cumulative player stats for a season (Feed TM4). This feed is paginated.

Parameters:
  • tournament_calendar_uuid (str) – The UUID for the specific tournament calendar (season).

  • contestant_uuid (str, optional) – Filter by a specific contestant (team).

  • detailed (bool, optional) – Request detailed stats (default: True).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests.

  • optimize (bool, optional) – Whether to optimize the plan.

Returns:

A Flow yielding a stream of player stat records.

Return type:

Flow

possession(fixture_uuid: str, use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw possession and territorial advantage data (Feed MA5).

Provides a breakdown of ball possession during a match, including overall % possession and territorial advantage, split by time period (last 5, 10, 15, 20, 25, 30 minutes).

Parameters:
  • fixture_uuid (str) – The UUID for the specific match/fixture.

  • use_opta_names (bool, optional) – Request ‘en-op’ locale for Opta-specific names (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw possession and territorial advantage data.

Return type:

Flow

Raises:

ValueError – If ‘fixture_uuid’ is not provided.

rankings(tournament_calendar_uuid: str, use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw rankings data (Feed PE4).

Get rankings data for all players, teams and games in a range of statistical categories within a tournament calendar (season).

Parameters:
  • tournament_calendar_uuid (str) – The UUID for the specific tournament calendar (season).

  • use_opta_names (bool, optional) – Request ‘en-op’ locale for Opta-specific names (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw rankings data.

Return type:

Flow

Raises:

ValueError – If ‘tournament_calendar_uuid’ is not provided.

referees(person_uuid: str | None = None, tournament_calendar_uuid: str | None = None, stage_uuid: str | None = None, use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw referee data (Feed PE3). This feed is paginated.

You must specify exactly one of ‘person_uuid’, ‘tournament_calendar_uuid’, or ‘stage_uuid’.

Parameters:
  • person_uuid (str, optional) – Filter by a specific person (referee) UUID.

  • tournament_calendar_uuid (str, optional) – Filter by a specific tournament calendar UUID.

  • stage_uuid (str, optional) – Filter by a specific stage UUID.

  • use_opta_names (bool, optional) – Request ‘en-op’ locale for Opta-specific names (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw referee data.

Return type:

Flow

Raises:

ValueError – If the parameter combination is invalid (e.g., none or multiple filter UUIDs are provided).

squads(tournament_calendar_uuid: str | None = None, contestant_uuid: str | None = None, use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw squad data (Feed TM3).

Parameters:
  • tournament_calendar_uuid (str, optional) – Filter by tournament calendar UUID.

  • contestant_uuid (str, optional) – Filter by a specific contestant (team) UUID.

  • use_opta_names (bool, optional) – Request ‘en-op’ locale for Opta-specific names (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw squad data.

Return type:

Flow

Raises:

ValueError – If neither ‘tournament_calendar_uuid’ nor ‘contestant_uuid’ is provided.

team_season_stats(tournament_calendar_uuid: str, contestant_uuid: str | None = None, detailed: bool = True, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of cumulative team stats for a season (Feed TM4). This feed is paginated.

Parameters:
  • tournament_calendar_uuid (str) – The UUID for the specific tournament calendar (season).

  • contestant_uuid (str) – Filter by a specific contestant (team).

  • detailed (bool, optional) – Request detailed stats (default: True).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests.

  • optimize (bool, optional) – Whether to optimize the plan.

Returns:

A Flow yielding a stream of team stat records.

Return type:

Flow

team_standings(tournament_calendar_uuid: str, stage_uuid: str | None = None, live: bool = False, type: Literal['total', 'home', 'away', 'form-total', 'form-home', 'form-away', 'half-time-total', 'half-time-home', 'half-time-away', 'attendance', 'over-under', 'relegation', 'championship'] | None = None, use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw team standings data (Feed TM2).

Provides league table data including position, points, matches played/won/lost/drawn, goals scored/conceded, and goal difference. Supports different division types such as home/away form and half-time standings.

Parameters:
  • tournament_calendar_uuid (str) – The UUID for the specific tournament calendar (season).

  • stage_uuid (str, optional) – Filter by a specific stage UUID.

  • live (bool, optional) – Request live standings data (default: False).

  • type (str, optional) – Filter by division type. Available values: ‘total’ (default), ‘home’, ‘away’, ‘form-total’, ‘form-home’, ‘form-away’, ‘half-time-total’, ‘half-time-home’, ‘half-time-away’, ‘attendance’, ‘over-under’, ‘relegation’, ‘championship’.

  • use_opta_names (bool, optional) – Request ‘en-op’ locale for Opta-specific names (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw team standings data.

Return type:

Flow

Raises:

ValueError – If ‘tournament_calendar_uuid’ is not provided.

teams(tournament_calendar_uuid: str | None = None, contestant_uuid: str | None = None, country_uuid: str | None = None, stage_uuid: str | None = None, series_uuid: str | None = None, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw team data (Feed TM1).

Parameters:
  • tournament_calendar_uuid (str, optional) – Filter by tournament calendar UUID.

  • contestant_uuid (str, optional) – Filter by a specific contestant (team) UUID.

  • country_uuid (str, optional) – Filter by country UUID.

  • stage_uuid (str, optional) – Filter by stage UUID.

  • series_uuid (str, optional) – Filter by series UUID.

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw team data.

Return type:

Flow

Raises:

ValueError – If neither ‘tournament_calendar_uuid’ nor ‘contestant_uuid’ is provided.

tournament_calendars(status: Literal['all', 'active', 'authorized', 'active_authorized'] = 'all', competition_uuid: str | None = None, contestant_uuid: str | None = None, include_stages: bool = False, include_coverage: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw tournament calendar data (Feed OT2).

Parameters:
  • status (Literal["all", "active", "authorized", "active_authorized"], optional) – Filter tournaments by status (default: “all”).

  • competition_uuid (str, optional) – Filter by a specific competition UUID.

  • contestant_uuid (str, optional) – Filter by a specific contestant (team) UUID.

  • include_stages (bool, optional) – Include tournament stage information (default: False).

  • include_coverage (bool, optional) – Include coverage information (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw tournament calendar data.

Return type:

Flow

tournament_schedule(tournament_calendar_uuid: str, coverage_level: int | List[int] | None = None, use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw tournament schedule data (Feed MA0).

Parameters:
  • tournament_calendar_uuid (str) – The UUID for the specific tournament calendar (season).

  • coverage_level (int or List[int], optional) – Filter by coverage level(s). Can be a single integer or list of integers.

  • use_opta_names (bool, optional) – Request ‘en-op’ locale for Opta-specific names (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw tournament schedule data.

Return type:

Flow

transfers(person_uuid: str | None = None, contestant_uuid: str | None = None, competition_uuid: str | None = None, tournament_calendar_uuid: str | None = None, start_date: str | datetime | date | None = None, end_date: str | datetime | date | None = None, use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw player transfer data (Feed TM7).

Fetches by person (non-paginated) or by other criteria (paginated). You must specify at least one of ‘person_uuid’, ‘contestant_uuid’, ‘competition_uuid’, or ‘tournament_calendar_uuid’.

Parameters:
  • person_uuid (str, optional) – Filter by a specific person UUID.

  • contestant_uuid (str, optional) – Filter by a specific contestant (team) UUID.

  • competition_uuid (str, optional) – Filter by a specific competition UUID. Required when using date parameters.

  • tournament_calendar_uuid (str, optional) – Filter by a specific tournament calendar UUID. Cannot be used with date parameters.

  • start_date (str, datetime, or date, optional) – The start date for filtering (YYYY-MM-DD). Requires ‘end_date’ and ‘competition_uuid’.

  • end_date (str, datetime, or date, optional) – The end date for filtering (YYYY-MM-DD). Requires ‘start_date’ and ‘competition_uuid’.

  • use_opta_names (bool, optional) – Request ‘en-op’ locale for Opta-specific names (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw transfer data (grouped by person).

Return type:

Flow

Raises:

ValueError – If parameter combinations are invalid (e.g., no filters, partial date range, or invalid date parameter usage).

venues(tournament_calendar_uuid: str | None = None, contestant_uuid: str | None = None, venue_uuid: str | None = None, use_opta_names: bool = False, creds: dict | None = None, proxies: dict | None = None, optimize: bool = False) Flow[source]#

Return a Flow of raw venue data (Feed OT3). This feed is paginated.

Note: You must specify at least one of ‘tournament_calendar_uuid’, ‘contestant_uuid’, or ‘venue_uuid’.

Parameters:
  • tournament_calendar_uuid (str, optional) – Filter by a specific tournament calendar UUID.

  • contestant_uuid (str, optional) – Filter by a specific contestant (team) UUID.

  • venue_uuid (str, optional) – Filter by a specific venue UUID.

  • use_opta_names (bool, optional) – Request ‘en-op’ locale for Opta-specific names (default: False).

  • creds (dict, optional) – Credentials for Opta API.

  • proxies (dict, optional) – Proxies dictionary for requests (e.g., {‘http’: ‘socks5h://…’}).

  • optimize (bool, optional) – Whether to optimize the plan (default: False).

Returns:

A Flow yielding raw venue data.

Return type:

Flow

Raises:

ValueError – If no filter (tmcl, ctst, or venue) is provided.