Skip to content

Instantly share code, notes, and snippets.

@benrules2
Created October 29, 2016 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benrules2/b4f0dcb2a93e6babc11e2e04dfe6dc53 to your computer and use it in GitHub Desktop.
Save benrules2/b4f0dcb2a93e6babc11e2e04dfe6dc53 to your computer and use it in GitHub Desktop.
Get Odds
def get_sport_odds(base_url, username, password, sport = '15'):
url = base_url + '/v1/odds?sportId=' + str(sport) + '&oddsFormat=DECIMAL'
b64str = base64.b64encode("{}:{}".format(username,password).encode('utf-8'))
headers = {'Content-length' : '0',
'Content-type' : 'application/json',
'Authorization' : "Basic " + b64str.decode('utf-8')
}
req = ulib.Request(url, headers=headers)
responseData = ulib.urlopen(req).read()
odds = json.loads(responseData.decode('utf-8'))
return odds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment