Skip to content

Instantly share code, notes, and snippets.

@benrules2
Created October 29, 2016 19:47
Show Gist options
  • Save benrules2/0ea2328a29610c35fa9dae50bfb39b92 to your computer and use it in GitHub Desktop.
Save benrules2/0ea2328a29610c35fa9dae50bfb39b92 to your computer and use it in GitHub Desktop.
Place Bet
def place_bet(base_url, username, password, bet, stake):
url = base_url + "/v1/bets/place"
b64str = base64.b64encode("{}:{}".format(username,password).encode('utf-8'))
headers = {'Content-length' : '1',
'Content-type' : 'application/json',
'Authorization' : "Basic " + b64str.decode('utf-8')}
data = {
"uniqueRequestId":uuid.uuid4().hex,
"acceptBetterLine": str(True),
"stake": str(float(stake)),
"winRiskStake":"RISK",
"sportId":str(int(bet['sportId'])),
"eventId":str(int(bet['eventId'])),
"lineId":str(int(bet['lineId'])),
"periodNumber":str(int(bet['period'])),
"betType":"MONEYLINE",
"team":bet['team'],
"oddsFormat":"DECIMAL"
}
req = ulib.Request(url, headers = headers)
response = ulib.urlopen(req, json.dumps(data).encode("utf-8")).read().decode()
response = json.loads(response)
print("Bet status: " + response["status"])
Copy link

ghost commented Aug 20, 2017

Can you please shed some light on this: what is the difference in winRiskStake between WIN and RISK?
Also, what is the bet['period']? What period are we talking about here?
Since Pinnacle doesn't provide support for their API I'm struggling to find an answer. I hope you can help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment