def get_greens_in_regulation(year1, year2, page_layout):
    for year in range(year1, year2):
        link = "http://www.pgatour.com/stats/stat.103.{}.html".format(year)
        page = PGATourPage(page_layout, link)
        stats = page.get_players_statistics()
        file_path = dirname(abspath(__file__))
        file_name = "{}_greens_in_regulation.json".format(year)
        write_to = "{}/json/greens_in_regulation/{}".format(file_path, file_name)
        with open(write_to, "w") as f:
            json.dump(stats, f)
            print("Completed -- {}".format(file_name))
Ejemplo n.º 2
0
def get_scoring_averages(year1, year2, page_layout):
    for year in range(year1, year2):
        link = "http://www.pgatour.com/stats/stat.101.{}.html".format(year)
        page = PGATourPage(page_layout, link)
        stats = page.get_players_statistics()
        file_path = dirname(abspath(__file__))
        file_name = "{}_driving_distance.json".format(year)
        write_to = "{}/json/driving_distance/{}".format(file_path, file_name)
        with open(write_to, "w") as f:
            json.dump(stats, f)
            print("Completed -- {}".format(file_name))