This file contains hidden or 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
| import tweepy | |
| consumer_key = 'consumer_key' | |
| consumer_secret = 'consumer_secret' | |
| access_key = 'access_key' | |
| access_secret = 'access_secret' | |
| def authorize_account(consumer_key = consumer_key, consumer_secret = consumer_secret, | |
| access_key = access_key, access_secret = access_secret): | |
| auth = tweepy.OAuthHandler(consumer_key, consumer_secret) |
This file contains hidden or 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
| if __name__ == "__main__": | |
| base_url = "https://api.pinnaclesports.com" | |
| username = <username> | |
| password = <password> | |
| stake = 1.5 | |
| balance = get_balance(base_url, username, password) | |
| odds = get_sport_odds(base_url, username, password) | |
| bet = find_bet(odds) |
This file contains hidden or 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, |
This file contains hidden or 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_bet_info(base_url, username, password, bet, favourable_odds = 1.91): | |
| b64str = base64.b64encode("{}:{}".format(username,password).encode('utf-8')) | |
| headers = {'Content-length' : '0', | |
| 'Content-type' : 'application/json', | |
| 'Authorization' : "Basic " + b64str.decode('utf-8')} | |
| url_without_team = base_url + "/v1/line?sportId={0}&leagueId={1}&eventId={2}&periodNumber={3}&betType=MONEYLINE&OddsFormat=DECIMAL"\ | |
| .format(bet['sportId'], bet['leagueId'], bet['eventId'],bet['period']) | |
| url = url_without_team + "&Team=Team1" |
This file contains hidden or 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 find_bet(all_odds): | |
| bet_info = {} | |
| favourable_odds = 1.91 | |
| bet_info['sportId'] = all_odds['sportId'] | |
| for i in all_odds['leagues']: | |
| bet_info['leagueId'] = i['id'] | |
| for j in i['events']: | |
| bet_info['eventId'] = j['id'] | |
| for k in j['periods']: | |
| bet_info['period'] = k['number'] |
This file contains hidden or 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() |
This file contains hidden or 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_balance(base_url, username, password): | |
| url = base_url + "/v1/client/balance" | |
| 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() | |
| balance = json.loads(responseData.decode('utf-8')) |
NewerOlder