Skip to content

feat: add get_live_match_events for the DataCore /live PBP endpoint - #31

Open
mad4ms wants to merge 1 commit into
mainfrom
feat/live-pbp-endpoint
Open

feat: add get_live_match_events for the DataCore /live PBP endpoint#31
mad4ms wants to merge 1 commit into
mainfrom
feat/live-pbp-endpoint

Conversation

@mad4ms

@mad4ms mad4ms commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds HandballAPI.get_live_match_events, wrapping the generated fixture_pbp_list_live (/handball/o/{org}/fixtures/{fixture_id}/playbyplay/live) endpoint the same way get_match_events wraps the non-live PBP export.
  • Documents and tests the scope requirement: /live needs read:organization_live in addition to read:organization. Without it, the API returns 403 with "explicit deny in an identity-based policy" — not a normal auth failure, so it's easy to mistake for a broken token refresh.
  • Confirmed live against org h1s44: a token requested with both scopes is accepted by /live; the same token without the extra scope is denied even though every other endpoint keeps working normally.

Changes

  • src/sportradar_datacore_api/handball.py: new get_live_match_events(match_id, *, limit=1000, offset=None), mirroring get_match_events's shape and error handling.
  • test/test_handball.py: api fixture now requests read:organization_live too; added test_live_fixture_events.
  • docs/api-reference.md, README.md: document the new method and the scope requirement.

Test plan

  • uv run ruff check src test
  • uv run mypy src/sportradar_datacore_api
  • uv run pytest (6/6 passed against the live API, including the new live-PBP test)
  • Manual check: same fixture, same client, only the scope list differs — read:organization alone -> 403 explicit-deny on /live; read:organization + read:organization_live -> 200 with real live PBP events.

The /live play-by-play endpoint needs the read:organization_live scope
on top of read:organization; without it the API returns a 403
explicit-deny rather than an auth error, which looks like a broken
token refresh until you notice the plain PBP endpoint still works.

Verified live against org h1s44: requesting both scopes issues a token
that the /live endpoint accepts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant