def get_relevant_match(self, league, start_date, end_date): home = league_analysis.alias_team(self.home) away = league_analysis.alias_team(self.away) matches = league_analysis.get_matches(league, start_date, end_date, home_team=home, away_team=away) match = matches[0] self.match = match return match
def __init__(self, bet_line): """Example Correct Score bet line: Bristol Rovers v Barnet: 1 - 1, 7.0 Example of a Result bet line: Walsall v Doncaster: Walsall, 1.97 """ self.parse_result_line(bet_line) for league in all_leagues: home = league_analysis.alias_team(self.home) away = league_analysis.alias_team(self.away) if home in league.teams and away in league.teams: self.league = league break else: message = "Match not found in any league, {0} vs {1}" raise Exception(message.format(bet_line.home, bet_line.away))