Suppose your dashboard needs one number, the decimal moneyline for Mesa at a particular book. Your first request produces a blank cell. It could mean the account ran out of credits. It could also mean the call succeeded and that bookmaker was absent. Those two failures look identical after a careless except: return []. They call for different actions.
Run the eight cases in Colab or read the Python notebook on GitHub. The examples use invented teams and responses. Every cell runs offline with Python’s standard library.
Compare these response bodies from the exercise. Both have status 403.
{"detail": {"error": "OUT_OF_USAGE_CREDITS"}}
{"detail": {"error": "HISTORICAL_LIMIT"}}
In the first case, pause paid reads and inspect the account’s allowance and reset. In the second, check the requested date against the plan’s historical lookback. Changing dates changes the research question. Before collecting another sample, confirm that the new date is relevant and that the requested sport and source have archive rows.
The ParlayAPI Python 0.3.5 client maps these structured refusals to CreditLimitExceededError and TierGatedError. A generic 403 without a recognized detail gives you less information. Record that uncertainty. Released client examples
The authenticated sport odds route returns an array. The keyless preview wraps its array in an events field. Choose the parser for the route you called. Calling body.get("events", []) on the authenticated list raises an attribute error. If your error handler returns an empty list, a parser bug now looks like a board with no games.
Work from the fixture toward the price. In this exercise the event ID is practice-17. First require one event with that ID and confirm its sport. Within that event, require one matching bookmaker, then the h2h market, then the named team. This function checks one level of the chain.
def exactly_one(rows, field, value, label):
if not isinstance(rows, list) or not all(
isinstance(row, dict) and field in row for row in rows
):
raise ValueError(f"Check the {label} response shape")
found = [row for row in rows if row[field] == value]
if len(found) != 1:
raise ValueError(f"{len(found)} matching {label} rows")
return found[0]
Here is what the notebook prints for three successful HTTP responses.
| Fictional response | What the parser can establish |
|---|---|
| Empty array | 0 matching event rows |
| Correct event with an empty bookmaker list | 0 matching book rows |
| Correct event, book, market and side with decimal price 1.91 | The selected price is 1.91. Its market clock still needs checking. |
A different bookmaker may have a price for the same team. Substituting it silently would hide the very coverage gap you’re investigating. The notebook also rejects a duplicate fixture and a fixture carrying a different sport key. A prop exercise would need further identity fields such as player, period and line.
Retry-After gives a waiting instruction. Check the scope and budget before making another call.If the result is still unexplained, give Support a small, reviewed account of one request. The downloadable Python tool accepts selected metadata and omits request IDs by default. The web form accepts a text excerpt. Private support report · Support form
Open the keyless odds preview. Select a sport and load its sample. Pick one event and look for the book and outcome you need. A missing book tells you about that sample only. The first-request walkthrough shows how to save the returned rows in Python.
When you need to run an authenticated request for your own project, create a ParlayAPI account.