def store_local_data(): sn_json = api.Session(auth.username, auth.key, season=2017, data_format="json") sn_xml = api.Session(auth.username, auth.key, season=2017, data_format="xml") os.chdir("C:/Users/stacy/OneDrive/Projects/FIRST_API/tbap/data") season_json = api.get_season(sn_json) with open("season_json.pickle", "wb") as f: pickle.dump(season_json, f, pickle.HIGHEST_PROTOCOL) season_xml = api.get_season(sn_xml) with open("season_xml.pickle", "wb") as f: pickle.dump(season_xml, f, pickle.HIGHEST_PROTOCOL) status_json = api.get_status(sn_json) with open("status_json.pickle", "wb") as f: pickle.dump(status_json, f, pickle.HIGHEST_PROTOCOL) status_xml = api.get_status(sn_xml) with open("status_xml.pickle", "wb") as f: pickle.dump(status_xml, f, pickle.HIGHEST_PROTOCOL) districts_json = api.get_districts(sn_json) with open("districts_json.pickle", "wb") as f: pickle.dump(districts_json, f, pickle.HIGHEST_PROTOCOL) districts_xml = api.get_districts(sn_xml) with open("districts_xml.pickle", "wb") as f: pickle.dump(districts_xml, f, pickle.HIGHEST_PROTOCOL) events_json = api.get_events(sn_json, district="PNW") with open("events_json.pickle", "wb") as f: pickle.dump(events_json, f, pickle.HIGHEST_PROTOCOL) events_xml = api.get_events(sn_xml, district="PNW") with open("events_jxml.pickle", "wb") as f: pickle.dump(events_xml, f, pickle.HIGHEST_PROTOCOL) teams_json = api.get_teams(sn_json, district="PNW") with open("teams_json.pickle", "wb") as f: pickle.dump(teams_json, f, pickle.HIGHEST_PROTOCOL) teams_xml = api.get_teams(sn_xml, district="PNW") with open("teams_xml.pickle", "wb") as f: pickle.dump(teams_xml, f, pickle.HIGHEST_PROTOCOL)
def test_year_full(self): sn = api.Session(auth.username, auth.key) events = api.get_events(sn, year=2016) tdata = {"shape": (203, 32), "args": ["events", 2016], "index_name": "key", "spotcheck": ("2016waamv", "city", "Auburn")} CheckResults.frame(events, tdata)
def test_team_simple(self): sn = api.Session(auth.username, auth.key) events = api.get_events(sn, team="frc1318", year="2017") tdata = {"shape": (8, 32), "args": ["team", "frc1318", "events", "2017"], "spotcheck": ("2017cmptx", "event_type_string", "Championship Finals")} CheckResults.frame(events, tdata)
def test_event_simple(self): sn = api.Session(auth.username, auth.key) events = api.get_events(sn, event="2017tur", response="simple") tdata = {"shape": (1, 10), "args": ["event", "2017tur", "simple"], "spotcheck": ("2017tur", "name", "Turing Division")} CheckResults.frame(events, tdata)
def test_district_full(self): sn = api.Session(auth.username, auth.key) events = api.get_events(sn, district="2017pnw") tdata = {"shape": (10, 32), "args": ["district", "2017pnw", "events"], "spotcheck": ("2017waamv", "postal_code", "98092")} CheckResults.frame(events, tdata)
def test_year_keys(self): sn = api.Session(auth.username, auth.key) events = api.get_events(sn, year=2016, response="keys") tdata = {"shape": (203, 1), "args": ["events", 2016, "keys"], "spotcheck": (196, "key", "2016wasno")} CheckResults.frame(events, tdata)
def test_year_simple(self): sn = api.Session(auth.username, auth.key) events = api.get_events(sn, year=2016, response="simple") tdata = {"shape": (203, 13), "args": ["events", 2016, "simple"], "spotcheck": ("2016wasno", "city", "Snohomish")} CheckResults.frame(events, tdata)