How to use the yfpy.models.Roster 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
"coverage_type": "week",
                          "is_flex": 0,
                          "position": "QB",
                          "week": "1"
                        },
                        "uniform_number": "12"
                      }
                    },
                    ...
                  ]
                }
        """
        team_key = self.get_league_key() + ".t." + str(team_id)
        return self.query(
            "https://fantasysports.yahooapis.com/fantasy/v2/team/" + str(team_key) + "/roster;week=" +
            str(chosen_week), ["team", "roster"], Roster)
github uberfastman / yfpy / yfpy / models.py View on Github external
YahooFantasyObject.__init__(self, extracted_data)
        self.clinched_playoffs = self.extracted_data.get("clinched_playoffs", "")
        self.division_id = self.extracted_data.get("division_id")
        self.draft_grade = self.extracted_data.get("draft_grade", "")
        self.draft_position = self.extracted_data.get("draft_position", "")
        self.draft_recap_url = self.extracted_data.get("draft_recap_url", "")
        self.draft_results = self.extracted_data.get("draft_results", "")
        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)