streamcom-scoreboard-client 2.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,109 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ from enum import StrEnum
5
+ from typing import Literal, Optional
6
+
7
+ GoneKind = Literal["court", "match", "competition"]
8
+ """What left a stream's reach."""
9
+
10
+ _ROUTE: dict[str, str] = {
11
+ "court": "GET /api/v2/courts",
12
+ "match": "GET /api/v2/matches",
13
+ "competition": "GET /api/v2/competitions",
14
+ }
15
+
16
+
17
+ class StreamErrorCode(StrEnum):
18
+ """What a :class:`StreamError` is about, spelled as the npm package writes it."""
19
+
20
+ UNAUTHORIZED = "unauthorized"
21
+ """The server does not accept the token (401)."""
22
+ NOT_FOUND = "not_found"
23
+ """An id followed is not this key's, or the address has no stream behind it (404)."""
24
+ RATE_LIMITED = "rate_limited"
25
+ """Too many new streams this minute, or too many open at once (429)."""
26
+ REFUSED = "refused"
27
+ """Any other refusal of the connection (400, 5xx)."""
28
+
29
+
30
+ class StreamError(Exception):
31
+ """Something somebody has to act on, in words that name the action: a refused token, a rate
32
+ limit, an id this key cannot read. What the stream's ``error`` handlers receive; the stream
33
+ never raises it.
34
+
35
+ A dropped network connection is not one of these: it is reported as a connection change and
36
+ redialled, because nothing about it is yours to fix.
37
+ """
38
+
39
+ def __init__(
40
+ self,
41
+ code: StreamErrorCode,
42
+ message: str,
43
+ status: Optional[int] = None,
44
+ retry_in_ms: Optional[int] = None,
45
+ ) -> None:
46
+ super().__init__(message)
47
+ self.code = code
48
+ self.status = status
49
+ """The HTTP status the connection was refused with, or ``None``."""
50
+ self.retry_in_ms = retry_in_ms
51
+ """When the stream dials again on its own, in ms, or ``None`` when it will not."""
52
+
53
+ @property
54
+ def message(self) -> str:
55
+ return str(self)
56
+
57
+
58
+ def _seconds(ms: int) -> str:
59
+ return f"{max(1, round(ms / 1000))} s"
60
+
61
+
62
+ def refusal_error(status: int, retry_in_ms: int, source: str) -> StreamError:
63
+ """A refused connection, in words for the person reading the log."""
64
+ retry = f" Retrying in {_seconds(retry_in_ms)}."
65
+ if status == 401:
66
+ return StreamError(
67
+ StreamErrorCode.UNAUTHORIZED,
68
+ f"{source} refused the token (401): it is unknown, revoked or expired. Use a current"
69
+ " API key from the portal's Data feed page, passed as `token` on its own." + retry,
70
+ status,
71
+ retry_in_ms,
72
+ )
73
+ if status == 404:
74
+ return StreamError(
75
+ StreamErrorCode.NOT_FOUND,
76
+ f"{source} has no stream at this address (404). Check `url`: it is the API's own"
77
+ " address, wss://api.streamcom.eu unless you were given another." + retry,
78
+ status,
79
+ retry_in_ms,
80
+ )
81
+ if status == 429:
82
+ return StreamError(
83
+ StreamErrorCode.RATE_LIMITED,
84
+ f"{source} refused a new stream (429): a key may open 10 streams a minute and hold 100"
85
+ " open at once. Close the courts you no longer show." + retry,
86
+ status,
87
+ retry_in_ms,
88
+ )
89
+ if status == 400:
90
+ return StreamError(
91
+ StreamErrorCode.REFUSED,
92
+ f"{source} could not read the court id null (400). Use a `court_id` exactly as GET"
93
+ " /api/v1/courts lists it." + retry,
94
+ status,
95
+ retry_in_ms,
96
+ )
97
+ return StreamError(
98
+ StreamErrorCode.REFUSED, f"{source} refused the stream ({status}).{retry}", status, retry_in_ms
99
+ )
100
+
101
+
102
+ def unreadable_error(kind: GoneKind, id: str) -> StreamError:
103
+ """The answer to an id followed whose very first word is ``gone``: it is not this key's."""
104
+ return StreamError(
105
+ StreamErrorCode.NOT_FOUND,
106
+ f"{kind[0].upper()}{kind[1:]} {json.dumps(id, ensure_ascii=False)} is not available to this"
107
+ f" key: no such {kind}, or not in its reach. Use an id exactly as {_ROUTE[kind]} lists it"
108
+ " for this key.",
109
+ )
@@ -0,0 +1,290 @@
1
+ """The shapes public API v2 answers with, as typed dictionaries.
2
+
3
+ The client hands out the JSON exactly as the API sent it: keys in snake_case as on the wire,
4
+ times as ISO-8601 strings (:func:`streamcom_scoreboard.parse_time` reads one). v2 only ever
5
+ adds, so read a field you need and leave the rest; a field this version does not know is still
6
+ in the dictionary. A value of an enum this version does not know can arrive too.
7
+
8
+ ``ScoreboardDocument`` (a court's board) stays a plain dictionary: its fields depend on the
9
+ board, and absent, ``None`` and a value mean three different things there.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ from typing import Any, Literal, Optional, TypedDict
15
+
16
+ Sport = Literal["basketball", "waterpolo", "korfball", "hockey", "soccer", "handball"]
17
+ MatchStatus = Literal[
18
+ "scheduled", "starting", "live", "ended", "not_played", "unrecorded", "canceled"
19
+ ]
20
+ CourtStatus = Literal["live", "standby", "offline"]
21
+ ClubKind = Literal["club", "combination"]
22
+ Gender = Literal["men", "women", "mixed"]
23
+ CompetitionKind = Literal["league", "cup", "playoffs", "tournament"]
24
+ TimelineKind = Literal[
25
+ "score", "score-correction", "boundary", "shot-clock-expired", "timeout", "field"
26
+ ]
27
+
28
+ ScoreboardDocument = dict[str, Any]
29
+
30
+
31
+ class ClubMember(TypedDict):
32
+ id: str
33
+ name: str
34
+
35
+
36
+ class _ClubRefRequired(TypedDict):
37
+ id: str
38
+ name: str
39
+ kind: ClubKind
40
+
41
+
42
+ class ClubRef(_ClubRefRequired, total=False):
43
+ members: list[ClubMember]
44
+ """Only on a combination."""
45
+
46
+
47
+ class TeamRef(TypedDict):
48
+ id: Optional[str]
49
+ name: str
50
+ gender: Optional[Gender]
51
+ age_group: Optional[str]
52
+ federation_name: Optional[str]
53
+
54
+
55
+ class FederationRef(TypedDict):
56
+ id: str
57
+ name: str
58
+
59
+
60
+ class CompetitionRef(TypedDict):
61
+ id: str
62
+ series_id: str
63
+ kind: Optional[CompetitionKind]
64
+ code: Optional[str]
65
+ name: str
66
+ category: str
67
+ level: Optional[int]
68
+ group: Optional[str]
69
+ gender: Optional[Gender]
70
+ age_group: Optional[str]
71
+ season: str
72
+ federation: FederationRef
73
+
74
+
75
+ class Venue(TypedDict):
76
+ id: str
77
+ name: str
78
+ city: Optional[str]
79
+ timezone: str
80
+
81
+
82
+ class CourtRef(TypedDict):
83
+ id: str
84
+ name: str
85
+
86
+
87
+ class TeamColors(TypedDict):
88
+ primary: str
89
+ secondary: str
90
+
91
+
92
+ class PeriodScore(TypedDict):
93
+ period: int
94
+ home: int
95
+ away: int
96
+
97
+
98
+ class MatchTimes(TypedDict):
99
+ scheduled_start: str
100
+ projected_start: str
101
+ projected_end: str
102
+ started_at: Optional[str]
103
+ ended_at: Optional[str]
104
+
105
+
106
+ class MatchResult(TypedDict):
107
+ """Always the board's score, never the federation's result."""
108
+
109
+ home: int
110
+ away: int
111
+ periods: list[PeriodScore]
112
+ source: Literal["board"]
113
+
114
+
115
+ class CorrectedResult(TypedDict):
116
+ home: int
117
+ away: int
118
+
119
+
120
+ MatchSide = TypedDict(
121
+ "MatchSide",
122
+ {
123
+ "name": str,
124
+ "short": str,
125
+ "colors": Optional[TeamColors],
126
+ "logo_url": Optional[str],
127
+ "club": Optional[ClubRef],
128
+ "team": Optional[TeamRef],
129
+ },
130
+ )
131
+
132
+
133
+ class Match(TypedDict):
134
+ id: str
135
+ sport: Optional[Sport]
136
+ status: MatchStatus
137
+ times: MatchTimes
138
+ competition: Optional[CompetitionRef]
139
+ number: Optional[str]
140
+ round: Optional[str]
141
+ home: MatchSide
142
+ away: MatchSide
143
+ venue: Optional[Venue]
144
+ court: Optional[CourtRef]
145
+ live_data: bool
146
+ result: Optional[MatchResult]
147
+ corrected_result: Optional[CorrectedResult]
148
+ updated_at: str
149
+
150
+
151
+ # `from` is a Python keyword, hence the functional form.
152
+ MatchPage = TypedDict(
153
+ "MatchPage",
154
+ {
155
+ "server_time": str,
156
+ "from": Optional[str],
157
+ "to": Optional[str],
158
+ "matches": list[Match],
159
+ "next_cursor": Optional[str],
160
+ },
161
+ )
162
+
163
+ TimelineEvent = TypedDict(
164
+ "TimelineEvent",
165
+ {
166
+ "id": str,
167
+ "at": str,
168
+ "kind": TimelineKind,
169
+ "clock_ms": Optional[int],
170
+ "shot_clock_ms": Optional[int],
171
+ "board_period": Optional[int],
172
+ "counted_period": int,
173
+ "path": Optional[str],
174
+ "from": Optional[str],
175
+ "to": Optional[str],
176
+ "side": Optional[Literal["home", "away"]],
177
+ },
178
+ )
179
+
180
+
181
+ class Timeline(TypedDict):
182
+ server_time: str
183
+ match_id: str
184
+ events: list[TimelineEvent]
185
+ next_cursor: Optional[str]
186
+
187
+
188
+ class CompetitionSandbox(TypedDict):
189
+ source_competition_id: Optional[str]
190
+
191
+
192
+ class Competition(TypedDict):
193
+ id: str
194
+ series_id: str
195
+ kind: Optional[CompetitionKind]
196
+ code: Optional[str]
197
+ name: str
198
+ category: str
199
+ level: Optional[int]
200
+ group: Optional[str]
201
+ gender: Optional[Gender]
202
+ age_group: Optional[str]
203
+ season: str
204
+ federation: FederationRef
205
+ archived: bool
206
+ sandbox: Optional[CompetitionSandbox]
207
+ updated_at: str
208
+
209
+
210
+ class CompetitionTeam(TypedDict):
211
+ id: Optional[str]
212
+ name: str
213
+ gender: Optional[Gender]
214
+ age_group: Optional[str]
215
+ federation_name: Optional[str]
216
+ club: ClubRef
217
+
218
+
219
+ class Coverage(TypedDict):
220
+ teams: int
221
+ teams_on_streamcom: int
222
+
223
+
224
+ class CompetitionDetail(Competition):
225
+ teams: list[CompetitionTeam]
226
+ coverage: Coverage
227
+
228
+
229
+ class ClubSandbox(TypedDict):
230
+ source_club_id: Optional[str]
231
+ federation_ref: Optional[str]
232
+
233
+
234
+ Club = TypedDict(
235
+ "Club",
236
+ {
237
+ "id": str,
238
+ "name": str,
239
+ "short": str,
240
+ "colors": Optional[TeamColors],
241
+ "logo_url": Optional[str],
242
+ "kind": ClubKind,
243
+ "members": list[ClubMember],
244
+ "teams": list[TeamRef],
245
+ "sandbox": Optional[ClubSandbox],
246
+ },
247
+ )
248
+
249
+
250
+ class Court(TypedDict):
251
+ id: str
252
+ name: str
253
+ sport: Optional[Sport]
254
+ status: CourtStatus
255
+ last_change: Optional[str]
256
+ owner: ClubRef
257
+ venue: Venue
258
+
259
+
260
+ class StreamLimits(TypedDict):
261
+ """What a stream connection is held to, from the server's ``welcome``. Read them rather than
262
+ copying them: they may move."""
263
+
264
+ streams_per_key: int
265
+ """Open streams per key, v1 and v2 together; past it a dial is refused with a 429."""
266
+ dials_per_minute: int
267
+ """New connections per key per minute, v1 and v2 together."""
268
+ max_queued: int
269
+ """Messages that may wait for this connection before it is closed (4002)."""
270
+ subscribe_max: int
271
+ """Ids per ``subscribe``."""
272
+ messages_burst: int
273
+ """Messages this connection may send in a row; one more each second."""
274
+ max_message_bytes: int
275
+ """The largest message this connection may send (1009 past it)."""
276
+ ping_interval_ms: int
277
+ """How often the server pings."""
278
+
279
+
280
+ class CourtSnapshot(TypedDict):
281
+ """The whole state of one court now. Replace what you hold with it; never merge."""
282
+
283
+ type: Literal["court-snapshot"]
284
+ court_id: str
285
+ sequence: int
286
+ server_time: str
287
+ status: CourtStatus
288
+ frozen: list[str]
289
+ data: ScoreboardDocument
290
+ match_id: Optional[str]
@@ -0,0 +1,237 @@
1
+ Metadata-Version: 2.5
2
+ Name: streamcom-scoreboard-client
3
+ Version: 2.0.0
4
+ Summary: Live data from Streamcom: matches, competitions and scoreboards on public API v2, with clocks resolved for you.
5
+ Author-email: StreamCom <support@streamcom.eu>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Keywords: broadcast,livescore,overlay,scoreboard,streamcom
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Typing :: Typed
13
+ Requires-Python: >=3.11
14
+ Requires-Dist: websockets>=17.4
15
+ Provides-Extra: test
16
+ Requires-Dist: mypy>=2.4.1; extra == 'test'
17
+ Requires-Dist: pytest>=9.2; extra == 'test'
18
+ Requires-Dist: pyyaml>=6.0.4; extra == 'test'
19
+ Description-Content-Type: text/markdown
20
+
21
+ # streamcom-scoreboard-client
22
+
23
+ Live data from Streamcom for Python: matches, competitions, clubs and courts on public API v2,
24
+ with clocks resolved for you. The Python twin of the npm package `@streamcom/scoreboard-client`
25
+ and the Java SDK `eu.streamcom:scoreboard-client`.
26
+
27
+ Python 3.11 or newer. One dependency: `websockets` 17.4 or newer, for the live stream.
28
+
29
+ ```sh
30
+ pip install streamcom-scoreboard-client
31
+ ```
32
+
33
+ ## A first call
34
+
35
+ Make an API key on the portal's **Data feed** page.
36
+
37
+ ```python
38
+ import os
39
+ from streamcom_scoreboard import StreamcomClient
40
+
41
+ streamcom = StreamcomClient(os.environ["STREAMCOM_TOKEN"])
42
+
43
+ for match in streamcom.matches.all(competition="cp7k2pq9x"):
44
+ print(match["home"]["name"], "–", match["away"]["name"], match["status"])
45
+ ```
46
+
47
+ The key goes in an `Authorization` header and never in a URL, and the client follows no redirect.
48
+ Every call blocks until it answers (or use [`AsyncStreamcomClient`](#asyncio)). A client is safe
49
+ to share between threads: make one per key and keep it.
50
+
51
+ | Option | Default | What it does |
52
+ | --- | --- | --- |
53
+ | `url` | production | another API address; `wss://` is read as `https://` |
54
+ | `timeout` | `30.0` | seconds one request may wait on the network |
55
+ | `retries` | `2` | how often no answer, a 5xx or a 429 is tried again; `0` never |
56
+ | `retry_backoff` | `Backoff(min=0.5, max=8.0)` | the wait between tries, doubling, jittered a fifth either way |
57
+ | `max_retry_wait` | `60.0` | a 429 waits for its `Retry-After`, unless that is longer than this: then it raises at once |
58
+ | `ssl_context` | system | your own TLS settings, for REST and the stream |
59
+
60
+ A 4xx other than 429 is never tried again. The client logs to the `streamcom_scoreboard` logger:
61
+ each retry at INFO, the stream's frames at DEBUG.
62
+
63
+ ## What it reads
64
+
65
+ | Call | Route |
66
+ | --- | --- |
67
+ | `matches.list(**filters, cursor=None)` | one page of `GET /api/v2/matches` |
68
+ | `matches.all(**filters)` | every match, page after page as you iterate |
69
+ | `matches.get(id)` | one match |
70
+ | `matches.timeline(id, cursor=None, limit=None)` / `matches.events(id)` | what the board did |
71
+ | `matches.sync(since=None, **filters)` | keep a set of matches up to date |
72
+ | `competitions.list(season=…, series=…, federation=…, updated_since=…)` | the competitions this key reaches |
73
+ | `competitions.get(id)` | one competition with its teams and coverage |
74
+ | `clubs.get(id)` | a club's face and teams |
75
+ | `clubs.logo(logo_url)` | the crest as bytes; the key goes along only to the API's own address |
76
+ | `courts.list()` | the courts this key reads |
77
+ | `courts.get(id)` | one court's whole board now |
78
+
79
+ Match filters: `competition`, `series`, `club`, `team`, `court`, `venue`, `status` (one or a
80
+ list), `from_`, `to`, `updated_since` (timezone-aware `datetime`s) and `limit` (1 to 200). With
81
+ no filter the API answers twelve hours either side of now; with a competition, its whole season.
82
+
83
+ Answers are the API's JSON as dictionaries, typed with `TypedDict`s in `streamcom_scoreboard.types`:
84
+ snake_case keys and ISO-8601 strings for times, which `parse_time` turns into a `datetime`. API v2
85
+ only adds, so a field this version does not know is still in the dictionary.
86
+
87
+ ## Keeping matches up to date
88
+
89
+ ```python
90
+ sync = streamcom.matches.sync(competition="cp7k2pq9x")
91
+ store(sync.matches, sync.since)
92
+
93
+ # later, every few minutes, with the `since` you stored:
94
+ sync = streamcom.matches.sync(sync.since, competition="cp7k2pq9x")
95
+ ```
96
+
97
+ Replace what you hold by `id`; a match may come twice. Store `sync.since` with the matches.
98
+
99
+ ## Clocks
100
+
101
+ A clock arrives as an anchor: `remaining_ms` was true at `as_of`. Read it, never tick it yourself:
102
+
103
+ ```python
104
+ from datetime import datetime, timezone
105
+ from streamcom_scoreboard import Clock
106
+
107
+ clock = Clock.from_wire(board["clock"])
108
+ reading = clock.read(datetime.now(timezone.utc), status="online")
109
+ print(reading.text) # "9:55"
110
+ reading.ticking # drive a render loop from this, never from clock.running
111
+ ```
112
+
113
+ A `streamed` clock is shown as received, and a clock on a source that is not online stands still.
114
+
115
+ ## Errors
116
+
117
+ A refusal raises `ApiError`, with a stable `code` apart from the message for a human:
118
+
119
+ ```python
120
+ from streamcom_scoreboard import ApiError, ApiErrorCode
121
+
122
+ try:
123
+ match = streamcom.matches.get(match_id)
124
+ except ApiError as e:
125
+ if e.code == ApiErrorCode.NOT_FOUND: # or e.code == "not_found"
126
+ ...
127
+ if e.code == ApiErrorCode.RATE_LIMITED:
128
+ wait_ms = e.retry_after_ms
129
+ ```
130
+
131
+ | `code` | When |
132
+ | --- | --- |
133
+ | `unauthorized` | no key, or one unknown, revoked or expired (401) |
134
+ | `not_found` | it does not exist **or is out of this key's reach** (404; there is no 403) |
135
+ | `invalid_request` | a filter, cursor or limit is wrong (400, 422) |
136
+ | `rate_limited` | 60 requests a minute per key, v1 and v2 together (429) |
137
+ | `internal_error` | on Streamcom's side; retry with backoff (5xx) |
138
+ | `network` | no answer at all, or one that was not the API's |
139
+
140
+ ## The live stream
141
+
142
+ One WebSocket follows any number of courts, matches and competitions, and holds what it heard:
143
+
144
+ ```python
145
+ stream = streamcom.stream(competitions=["cp7k2pq9x"], courts=["ct9w3d5ke"])
146
+
147
+ @stream.on_live
148
+ def cue(match):
149
+ print(match["home"]["name"], "–", match["away"]["name"], "is live")
150
+
151
+ @stream.on_board
152
+ def draw(court_id, fields, change):
153
+ print(court_id, fields.home.score, "–", fields.away.score, fields.clock.text)
154
+
155
+ with stream: # opens; closes on leaving the block
156
+ stream.wait() # or stream.run_forever(), which also stops on Ctrl+C
157
+ ```
158
+
159
+ Or iterate instead of handlers; both see every event, in order:
160
+
161
+ ```python
162
+ with streamcom.stream(courts=["ct9w3d5ke"]) as stream:
163
+ for event in stream.events():
164
+ if event.type == "board":
165
+ render(event.fields)
166
+ ```
167
+
168
+ | Event | Handler arguments | When |
169
+ | --- | --- | --- |
170
+ | `match` | `match, previous` | a match arrived or changed; `previous` is `None` the first time |
171
+ | `status` | `match, previous_status` | a held match changed status |
172
+ | `live` / `ended` | `match` | a held match turned live or ended: moments this stream saw |
173
+ | `gone` | `kind, id` | something followed left this key's reach; the rest keeps streaming |
174
+ | `board` | `court_id, fields, change` | a court's board moved |
175
+ | `connection` | `connected, reason` | up, or down with why; down is not fatal |
176
+ | `error` | `error` | a `StreamError` to act on: a refused key, a rate limit, an id this key cannot read |
177
+
178
+ Reads, safe from any thread: `stream.board(court_id)` (every clock resolved to now; call it from
179
+ a render loop to animate), `board_of(match_id)`, `match(id)`, `matches`, `match_on(court_id)`,
180
+ `courts`, `connected`, `connection_id`, `limits`. `subscribe(...)` and `unsubscribe(...)` change
181
+ what is followed while it runs.
182
+
183
+ A board field can be **absent** (this board does not have it: `ABSENT`, which is falsy),
184
+ **`None`** (it has it but did not say) or a value. Draw them differently.
185
+
186
+ The stream reconnects by itself and subscribes everything again: on `backoff` (1 to 30 s,
187
+ jittered), after a refusal's `Retry-After`, and when nothing was heard for `silence` seconds
188
+ (35). All three are options of `streamcom.stream(...)`, with `open_timeout` for one dial.
189
+ Handlers run on the stream's own events thread, one at a time; one that raises is logged and the
190
+ rest still run. With no `error` handler and no iterator, an error is logged as a warning.
191
+
192
+ ### In step with a video
193
+
194
+ A broadcast runs behind the hall, so a board drawn live over it shows a goal before the picture
195
+ does. Give the stream the UTC moment of the picture on screen and it works out the delay itself:
196
+
197
+ ```python
198
+ stream = streamcom.stream(courts=["ct9w3d5ke"])
199
+ stream.align_to(player.program_date_time) # e.g. the HLS EXT-X-PROGRAM-DATE-TIME of the frame shown
200
+ stream.open()
201
+
202
+ # whenever the player reports a time, every segment or every frame:
203
+ stream.align_to(player.program_date_time) # returns the delay; also in stream.delay
204
+ ```
205
+
206
+ From then on `board()`, its clocks and every match and board event are what the video shows:
207
+ each message waits until the picture reaches the moment it arrived. Call `align_to` again
208
+ whenever the player reports a time and the delay follows the drift. A delay that grows holds the
209
+ view still until the video catches up; one that shrinks jumps it forward. The connection, the
210
+ `connection` and `error` events and `subscribe` stay live.
211
+
212
+ The moment is a timezone-aware `datetime` or an ISO-8601 string with its offset. One more than
213
+ `max_delay` (300 s, an option of `stream(...)`) back raises `ValueError`: usually a local time
214
+ passed as UTC. Before the first `align_to` the view is live, so call it before `open()` when the
215
+ delay is known by then.
216
+
217
+ ## asyncio
218
+
219
+ ```python
220
+ from streamcom_scoreboard import AsyncStreamcomClient
221
+
222
+ streamcom = AsyncStreamcomClient(os.environ["STREAMCOM_TOKEN"]) # the same options
223
+ match = await streamcom.matches.get("mt4n8w2qa")
224
+ async for match in streamcom.matches.all(competition="cp7k2pq9x"):
225
+ ...
226
+
227
+ with streamcom.stream(courts=["ct9w3d5ke"]) as stream:
228
+ async for event in stream.aevents():
229
+ ...
230
+ ```
231
+
232
+ Each request runs on a worker thread, so the event loop never blocks; the retries and errors are
233
+ the blocking client's.
234
+
235
+ ## Licence
236
+
237
+ MIT
@@ -0,0 +1,19 @@
1
+ streamcom_scoreboard/__init__.py,sha256=ybvBh_xt1UXkYg_VbV2iybIKRRhhfhcgt8JdiZ-5oTI,1410
2
+ streamcom_scoreboard/_core.py,sha256=Qn6Kha08sWjpds9UbzSESdClFqrktduot3LZLCm67zI,18377
3
+ streamcom_scoreboard/_delay.py,sha256=j9WqUrTa6M7p3Taej_nLczj03TwV6DREUSWeZ0eQRJQ,2863
4
+ streamcom_scoreboard/_time.py,sha256=9eO699yZ4NWx4IBSTqTgvAJssKxDyxWHtmMI4Y3qxSY,666
5
+ streamcom_scoreboard/_version.py,sha256=_7OlQdbVkK4jad0CLdpI0grT-zEAb-qgFmH5mFzDXiA,22
6
+ streamcom_scoreboard/aio.py,sha256=7Ftc82SfnNUo6URq5Lho4D-E7Cl1ussa7CqVBX2J0tI,5372
7
+ streamcom_scoreboard/backoff.py,sha256=PxTs475kZipo3YvdJ3o0tg8wIlDVjo_Lh8jjEWi1ziU,1323
8
+ streamcom_scoreboard/board.py,sha256=uNgFIZA7yKjizU22mi6OEXe_ju3RVwfvncKN7Di6F70,22865
9
+ streamcom_scoreboard/client.py,sha256=Nwdv6XwECvsOgG9oHCW__nRx5ReevPZQm-E1kXAjQ64,18784
10
+ streamcom_scoreboard/clock.py,sha256=FnNV1Im2ZQVlh-CmgknuGO0AfuqeZyl0UlVkvbwnDls,5855
11
+ streamcom_scoreboard/errors.py,sha256=9WNK_JizYFnTJyoRNLmuWWl67P2kxntq1GM-tZhTtLU,4453
12
+ streamcom_scoreboard/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ streamcom_scoreboard/stream.py,sha256=qwqvSpoFHjyTUCOlkeIQwa2M9DFxlRbLSc44REoLsnk,29038
14
+ streamcom_scoreboard/stream_errors.py,sha256=13p-wdzxVHoS1IY8_Cvf-ynoEcGDQZd0ey1xPEoDwQ0,3958
15
+ streamcom_scoreboard/types.py,sha256=6seVRhqhf-GqJWKjh2o-zCSVfwLCmJBskQ_FhnxwPLM,6740
16
+ streamcom_scoreboard_client-2.0.0.dist-info/METADATA,sha256=emPcQp-4fquihoaGgAQoYHM28PaPTCLeRxdZSU-t72Q,9972
17
+ streamcom_scoreboard_client-2.0.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
18
+ streamcom_scoreboard_client-2.0.0.dist-info/licenses/LICENSE,sha256=cUZKeZIedGTzjweCrQvjjE59WFhVGI6mS4D23BUI0jg,1066
19
+ streamcom_scoreboard_client-2.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 StreamCom
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.