How to use the yfpy.models.League 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
"logo_url": "https://s.yimg.com/cv/api/default/20180206/default-league-logo@2x.png",
                  "name": "Yahoo Public 729259",
                  "num_teams": 10,
                  "renew": null,
                  "renewed": null,
                  "scoring_type": "head",
                  "season": "2014",
                  "start_date": "2014-09-04",
                  "start_week": "1",
                  "url": "https://football.fantasysports.yahoo.com/archive/nfl/2014/729259",
                  "weekly_deadline": null
                }
        """
        return self.query(
            "https://fantasysports.yahooapis.com/fantasy/v2/league/" + self.get_league_key() + "/metadata", ["league"],
            League)
github uberfastman / fantasy-football-metrics-weekly-report / dao / yahoo.py View on Github external
yahoo_fantasy_game = self.yahoo_data.retrieve(str(self.game_id) + "-game-metadata",
                                                          self.yahoo_query.get_game_metadata_by_game_id,
                                                          params={"game_id": self.game_id},
                                                          data_type_class=Game)
        else:
            yahoo_fantasy_game = self.yahoo_data.retrieve("current-game-metadata",
                                                          self.yahoo_query.get_current_game_metadata,
                                                          data_type_class=Game)

        self.league_key = yahoo_fantasy_game.game_key + ".l." + self.league_id
        self.season = yahoo_fantasy_game.season

        # YAHOO API QUERY: run query to retrieve all league information, including current standings
        self.league_info = self.yahoo_data.retrieve(str(self.league_id) + "-league-info",
                                                    self.yahoo_query.get_league_info,
                                                    data_type_class=League,
                                                    new_data_dir=os.path.join(self.data_dir,
                                                                              str(self.season),
                                                                              str(self.league_id)))  # type: League

        self.season = self.league_info.season
        self.current_week = self.league_info.current_week
        self.num_playoff_slots = self.league_info.settings.num_playoff_teams
        self.num_regular_season_weeks = int(self.league_info.settings.playoff_start_week) - 1
        self.num_divisions = int(len(self.league_info.settings.divisions))
        self.divisions = {
            str(division["division"].division_id): division["division"].name for
            division in self.league_info.settings.divisions
        }
        self.roster_positions = self.league_info.settings.roster_positions

        # validate user selection of week for which to generate report
github uberfastman / yfpy / yfpy / query.py View on Github external
"teams": [
                        ...,
                        ...
                    ],
                    ...
                  },
                  "start_date": "2014-09-04",
                  "start_week": "1",
                  "url": "https://football.fantasysports.yahoo.com/archive/nfl/2014/729259",
                  "weekly_deadline": null
                }
        """
        return self.query(
            "https://fantasysports.yahooapis.com/fantasy/v2/league/" + self.get_league_key() +
            ";out=metadata,settings,standings,scoreboard,teams,players,draftresults,transactions", ["league"],
            League)