Syntrex Claude Sonnet 4.6 commited on
Commit
e342bd3
·
1 Parent(s): 7b92abe

Fix 429 rate limiting: add 0.5s delay between per-event odds requests

Browse files

15 back-to-back HTTP calls with zero delay triggered the API's burst rate
limit (quota was only 30/20,000 — not exhausted). Adding 0.5s between each
per-event request brings the call rate to ~2/sec. Total fetch time ~7.5s,
cached for 300s so the delay is paid once per 5 minutes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. data/provider_theoddsapi.py +2 -0
data/provider_theoddsapi.py CHANGED
@@ -1,6 +1,7 @@
1
  from __future__ import annotations
2
 
3
  import logging as _logging
 
4
  from typing import Any
5
 
6
  import pandas as pd
@@ -324,6 +325,7 @@ class TheOddsAPIProvider(MarketProviderBase):
324
  odds_url,
325
  {k: (v if k != "apiKey" else v[:6] + "...") for k, v in odds_params.items()},
326
  )
 
327
  try:
328
  r2 = requests.get(odds_url, params=odds_params, timeout=30)
329
  _diag_log.info(
 
1
  from __future__ import annotations
2
 
3
  import logging as _logging
4
+ import time
5
  from typing import Any
6
 
7
  import pandas as pd
 
325
  odds_url,
326
  {k: (v if k != "apiKey" else v[:6] + "...") for k, v in odds_params.items()},
327
  )
328
+ time.sleep(0.5)
329
  try:
330
  r2 = requests.get(odds_url, params=odds_params, timeout=30)
331
  _diag_log.info(