Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
athompson92 opened this issue Oct 10, 2022 · 0 comments
Open

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

athompson92 opened this issue Oct 10, 2022 · 0 comments

Comments

@athompson92
Copy link

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
{}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant