Skip to main content

Python client for the OPTA Sports Data Soccer API

Project description

opta_sd

Python License: MIT

Python client for the OPTA Sports Data Soccer API (OPTA SDAPI).


Installation

pip install optasd

Or from source:

git clone https://github.com/MohanedAwad/opta_sd
cd opta_sd
pip install -e ".[dev]"

Configuration

Environment variables

API_URL=https://api.performfeeds.com
API_TOKEN=your-token-here
REFERER_DOMAIN=https://{your-referer}.com

Quick Start

from opta_sd.soccer import Match, TournamentCalendar, TeamStandings
from opta_sd.cache import MemoryCache
from datetime import datetime, timedelta

# Basic match lookup
match = await Match().resource("bsu6pjne1eqz2hs8r3685vbhl").live().lineups().get()
print(match.data)

# Competition matches within a time window
now = datetime.utcnow()
matches = await (
    Match()
    .competition("722fdbecxzcq9788l6jqclzlw")
    .time_range(now - timedelta(days=1), now + timedelta(days=1))
    .get()
)

# With in-memory caching (60-second TTL)
standings = (
    TeamStandings(cache=MemoryCache(ttl=60))
    .tournament("408bfjw6uz5k19zk4am50ykmh")
    .total()
    .get()
)
print(standings.from_cache)       # False on first call
print(standings.response_time_ms) # round-trip time in ms

Available Feeds

Feed Class Endpoint
Fixtures & Results Match /soccerdata/match/
Match Statistics MatchStatistics /soccerdata/matchstats/
Match Events MatchEvent /soccerdata/matchevent/
Pass Matrix & Avg Formation PassMatrix /soccerdata/passmatrix/
Possession Possession /soccerdata/possession/
Commentary Commentary /soccerdata/Commentary/
Match Facts MatchFacts /soccerdata/matchfacts/
Seasonal Stats SeasonalStats /soccerdata/seasonstats/
Squads Squads /soccerdata/squads/
Team Standings TeamStandings /soccerdata/standings/
Player Career PlayerCareer /soccerdata/playercareer/
Tournament Calendars TournamentCalendar /soccerdata/tournamentcalendar/
Match Preview MatchPreview /soccerdata/matchpreview/
Rankings Rankings /soccerdata/rankings/
Tournament Schedule TournamentSchedule /soccerdata/tournamentschedule/
Venues Venues /soccerdata/venues/

License

MIT — see LICENSE.

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

opta_sd-0.1.3.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

opta_sd-0.1.3-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file opta_sd-0.1.3.tar.gz.

File metadata

  • Download URL: opta_sd-0.1.3.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for opta_sd-0.1.3.tar.gz
Algorithm Hash digest
SHA256 127295e7e4d596d1683e13e682e91907e9e1d81fff1a8b3576c3cdd3005b6e93
MD5 6c0aee33de204439fef1d0b2d36fa729
BLAKE2b-256 11a88e3924d7b24d4f9e8ac95e554dd79019a61084bc1d588e5d261f3d25fe6c

See more details on using hashes here.

File details

Details for the file opta_sd-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: opta_sd-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for opta_sd-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 49778e2f7ebaf31b87ff7da196f4a2fdbcecff6a2902922102caa04a3fd1e5a9
MD5 35ac4da062b88bfd423107eb19519466
BLAKE2b-256 a4977f9b3b0c398b087f607554e576343fa309059ed5d4bea1f50944d989fa38

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