Pagination
Every list comes 50 races a page, with the totals in meta.
| Field | Type | Meaning |
|---|---|---|
meta.count | integer | Races on this page. |
meta.page | integer | This page number. |
meta.per_page | integer | Always 50. |
meta.total | integer | Races in the whole list. |
meta.total_pages | integer | Pages in the whole list. |
meta.next_cursor | string | Pass it as cursor for the next page. null on the last page. |
By cursor
The simplest loop: call, keep the rows, and call again with cursor set to meta.next_cursor until it is null.
Python
params = {"date": "2024-03-09"}
rows = []
while True:
j = S.get("https://api.greyhoundracingapi.com/v1/results", params=params).json()
rows += j["data"]
if not j["meta"]["next_cursor"]: break
params["cursor"] = j["meta"]["next_cursor"]By page number
Pass page=2, page=3 and so on, up to meta.total_pages. Useful when you want one page in the middle.
Polling instead of paging
For today's results, do not page through the day every time. Call with since set to the newest settled_at you hold and you get only the races settled after it. See Today's results.