API Permissiond #119
barryokwaro
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I have this code I am running to check my bet history. But I am not seeing anything. Kindly someone let me know where I am going wrong:
import requests
API_KEY = 'myapi' # Replace with your actual API key
API_URL = "https://sports-api.cloudbet.com/pub/v4/bets/history"
headers = {
"accept": "application/json",
"X-API-Key": API_KEY
}
params = {
"limit": 5,
"offset": 0
}
try:
response = requests.get(API_URL, headers=headers, params=params, timeout=10)
response.raise_for_status()
bet_history = response.json()
print("✅ Bet History:")
for bet in bet_history.get("bets", []):
print(f"\n📅 Time: {bet.get('createTime')}")
print(f"🏟 Event: {bet.get('eventName')} (ID: {bet.get('eventId')})")
print(f"🎯 Market: {bet.get('marketUrl')}")
print(f"💰 Stake: {bet.get('stake')} {bet.get('currency')} @ {bet.get('price')}")
print(f"📦 Status: {bet.get('status')} | Return: {bet.get('returnAmount')}")
print(f"🔖 Ref ID: {bet.get('referenceId')}")
print(f"\n🔢 Total Bets: {bet_history.get('totalBets')}")
except requests.exceptions.HTTPError as http_err:
print(f"❌ HTTP error occurred: {http_err}")
except Exception as err:
print(f"❌ Other error occurred: {err}")
Beta Was this translation helpful? Give feedback.
All reactions