How to use the yfpy.models.Game 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
"stat": {
                          "display_name": "GP",
                          "name": "Games Played",
                          "sort_order": "1",
                          "stat_id": 0
                        }
                      },
                      ...
                  },
                  "type": "full",
                  "url": "https://football.fantasysports.yahoo.com/f1"
                }
        """
        return self.query(
            "https://fantasysports.yahooapis.com/fantasy/v2/game/" + self.game_code +
            ";out=metadata,players,game_weeks,stat_categories,position_types,roster_positions", ["game"], Game)
github uberfastman / yfpy / yfpy / query.py View on Github external
Example:
                {
                  "code": "nfl",
                  "game_id": "331",
                  "game_key": "331",
                  "is_game_over": 1,
                  "is_offseason": 1,
                  "is_registration_over": 1,
                  "name": "Football",
                  "season": "2014",
                  "type": "full",
                  "url": "https://football.fantasysports.yahoo.com/archive/nfl/2014"
                }
        """
        return self.query(
            "https://fantasysports.yahooapis.com/fantasy/v2/game/" + str(game_id) + "/metadata", ["game"], Game)
github uberfastman / fantasy-football-metrics-weekly-report / dao / yahoo.py View on Github external
self.league_id = league_id
        self.game_id = game_id
        self.config = config
        self.data_dir = data_dir
        self.save_data = save_data
        self.dev_offline = dev_offline

        self.yahoo_data = Data(self.data_dir, save_data=save_data, dev_offline=dev_offline)
        yahoo_auth_dir = os.path.join(base_dir, config.get("Yahoo", "yahoo_auth_dir"))
        self.yahoo_query = YahooFantasySportsQuery(yahoo_auth_dir, self.league_id, self.game_id, offline=dev_offline)

        if self.game_id and self.game_id != "nfl":
            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