Skip to content

kwargs for the api functions don't ignore None #6

Open
@athompson92

Description

@athompson92

if 'game_id' in params:

I hit this while testing the get_sp_ratings function where I set the team to None and the full rankings were not returned.

Ex.
def get_sp_rankings(year, team=None):
18 # create an instance of the API class
19 api_instance = cfbd.RatingsApi(cfbd.ApiClient(configuration))
20
21 sp_rankings = {}
22 try:
23 # Historical SP+ ratings
24 api_response = api_instance.get_sp_ratings(year=year, team=team)
25 #print(api_response)
26 #pprint(api_responsei)
27 for team in api_response[:-1]:
28 #print(team)
29 #print(team.team, team.ranking)
30 team_name = normalize_team_names(team.team)
31 sp_rankings[team_name] = str(int(team.ranking))
32
33 except ApiException as e:
34 print("Exception when calling RatingsApi->get_sp_ratings: %s\n" % e)
35
36 return sp_rankings
...
if name == "main":
76 y2018 = get_sp_rankings(2018)
77 print(y2018)

Output:
$ python3 cfbd_util.py
{}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions