opta_sd
Python client for the OPTA Sports Data Soccer API (OPTA SDAPI).
Installation
pip install opta-sd
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.
Metadata
Release files for opta-sd 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| opta_sd-0.1.4.tar.gz | 8.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opta_sd-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.3 kB
Release files / opta_sd-0.1.4.tar.gz
| Download URL | opta_sd-0.1.4.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
702717e9c52c1e0b8ac5bf63baba009be038c1bfec4f45f2ad23fd6fdf61725d
|
|
BLAKE2b-256 checksum How to use checksums |
f289081f47f17ce2b7db8348320cfe40f86601f33cbe305599048ae3a133cb9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / opta_sd-0.1.4-py3-none-any.whl
| Download URL | opta_sd-0.1.4-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a110544fc23dbe7d58a81edfc56c2bef9e410a63ff762766a7cee9af62c72a42
|
|
BLAKE2b-256 checksum How to use checksums |
8e756448e91a18a437286f599481c847764b829abc0d883440726d80bb6669eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|