class Matches(object): def __init__(self): with open(os.getenv("HOME") + "/.crowdscores", "r") as auth: self.token = auth.read() self.client = Crowdscores(self.token) def list_of_matches(self): #print(now) then = now - timedelta(hours=3) #print(then) self.raw_matches = self.client.get_matches(from_=then, to=now) #print(self.raw_matches) self.matches = {(match['homeTeam']['name'], match['awayTeam']['name']): (match['homeGoals'], match['awayGoals']) for match in self.raw_matches['response'] if match['currentState'] < 200} return self.matches
class Matches(object): def __init__(self): with open(os.getenv("HOME") + "/.crowdscores", "r") as auth: self.token = auth.read() self.client = Crowdscores(self.token) def list_of_matches(self): # print(now) then = now - timedelta(hours=3) # print(then) self.raw_matches = self.client.get_matches(from_=then, to=now) # print(self.raw_matches) self.matches = { (match["homeTeam"]["name"], match["awayTeam"]["name"]): (match["homeGoals"], match["awayGoals"]) for match in self.raw_matches["response"] if match["currentState"] < 200 } return self.matches