Created
October 29, 2016 19:47
-
-
Save benrules2/0ea2328a29610c35fa9dae50bfb39b92 to your computer and use it in GitHub Desktop.
Place Bet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.