How to use the yfpy.models.TeamPoints function in yfpy

To help you get started, we’ve selected a few yfpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uberfastman / yfpy / yfpy / query.py View on Github external
"""Retrieve stats of specific team by team_id for chosen league.

        :param team_id: team id of chosen team (can be integers 1 through n where n = number of teams in the league)
        :rtype: TeamPoints
        :return: yfpy TeamPoints objects
            Example:
                {
                  "coverage_type": "season",
                  "season": "2014",
                  "total": "1409.24"
                }
        """
        team_key = self.get_league_key() + ".t." + str(team_id)
        return self.query(
            "https://fantasysports.yahooapis.com/fantasy/v2/team/" + str(team_key) + "/stats",
            ["team", "team_points"], TeamPoints)
github uberfastman / yfpy / yfpy / models.py View on Github external
self.faab_balance = self.extracted_data.get("faab_balance", "")
        self.has_draft_grade = self.extracted_data.get("has_draft_grade", "")
        self.league_scoring_type = self.extracted_data.get("league_scoring_type", "")
        self.managers = self.extracted_data.get("managers", "")
        self.matchups = self.extracted_data.get("matchups", "")
        self.name = self.extracted_data.get("name", "").encode("utf-8")
        self.number_of_moves = self.extracted_data.get("number_of_moves", "")
        self.number_of_trades = self.extracted_data.get("number_of_trades", "")
        self.roster = self.extracted_data.get("roster", Roster({}))  # type: Roster
        self.players = self.roster.players
        self.roster_adds = self.extracted_data.get("roster_adds", RosterAdds({}))  # type: RosterAdds
        self.roster_adds_value = self.roster_adds.value
        self.team_id = self.extracted_data.get("team_id", "")
        self.team_key = self.extracted_data.get("team_key", "")
        self.team_logos = self.extracted_data.get("team_logos", "")
        self.team_points = self.extracted_data.get("team_points", TeamPoints({}))  # type: TeamPoints
        self.points = float(self.team_points.total)
        self.team_projected_points = self.extracted_data.get("team_projected_points",
                                                             TeamProjectedPoints({}))  # type: TeamProjectedPoints
        self.projected_points = float(self.team_projected_points.total)
        self.team_standings = self.extracted_data.get("team_standings", TeamStandings({}))  # type: TeamStandings
        self.wins = int(self.team_standings.outcome_totals.wins)
        self.losses = int(self.team_standings.outcome_totals.losses)
        self.ties = int(self.team_standings.outcome_totals.ties)
        self.percentage = float(self.team_standings.outcome_totals.percentage)
        self.playoff_seed = self.team_standings.playoff_seed
        self.points_against = self.team_standings.points_against
        self.points_for = self.team_standings.points_for
        self.rank = self.team_standings.rank
        self.streak_type = self.team_standings.streak.type
        self.streak_length = self.team_standings.streak.value
        self.url = self.extracted_data.get("url", "")