Created
October 29, 2016 19:45
-
-
Save benrules2/b4f0dcb2a93e6babc11e2e04dfe6dc53 to your computer and use it in GitHub Desktop.
Get Odds
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 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