-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_conditions.py
More file actions
52 lines (51 loc) · 1.38 KB
/
Copy pathdebug_conditions.py
File metadata and controls
52 lines (51 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""Debug: fetch first live game id and query its conditions."""
import os
import json
import requests
from dotenv import load_dotenv
load_dotenv()
url = (os.getenv("AZURO_SUBGRAPH_URL") or "").strip()
if not url:
print("AZURO_SUBGRAPH_URL not set")
exit(1)
# Get one game id from live query
q_live = """
query Live($from: Int!, $to: Int!) {
games(first: 1, where: { sport_: { slug: "football" }, startsAt_gte: $from, startsAt_lte: $to }, subgraphError: allow) {
id
gameId
startsAt
participants { name sortOrder }
}
}
"""
import time
now = int(time.time())
r = requests.post(url, json={"query": q_live, "variables": {"from": now - 7200, "to": now + 900}}, timeout=15)
print("Live games status:", r.status_code)
data = r.json()
if data.get("errors"):
print("Errors:", data["errors"])
games = (data.get("data") or {}).get("games") or []
if not games:
print("No games")
exit(0)
g = games[0]
game_id = g.get("id")
print("Game id:", game_id)
# Query conditions
# Try without status filter (data-feed subgraph may use different schema)
q_cond = """
query GameConditions($id: String!) {
game(id: $id) {
id
conditions {
conditionId
outcomes { outcomeId currentOdds }
}
}
}
"""
r2 = requests.post(url, json={"query": q_cond, "variables": {"id": game_id}}, timeout=15)
print("Conditions status:", r2.status_code)
print(json.dumps(r2.json(), indent=2)[:2000])