Skip to content

Commit

Permalink
BugFix: skater_stats_summary_simple, goalie_stats_summary_simple: Fix…
Browse files Browse the repository at this point in the history
…es double encoding bug that breaks in notebooks (#80)
  • Loading branch information
coreyjs authored Nov 11, 2024
1 parent 1993bff commit db2f7ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions nhlpy/api/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def skater_stats_summary_simple(
{"property": "gamesPlayed", "direction": "ASC"},
{"property": "playerId", "direction": "ASC"},
]
q_params["sort"] = urllib.parse.quote(json.dumps(sort_expr))
q_params["sort"] = json.dumps(sort_expr)

if not default_cayenne_exp:
default_cayenne_exp = f"gameTypeId={game_type_id} and seasonId<={end_season} and seasonId>={start_season}"
Expand Down Expand Up @@ -263,7 +263,7 @@ def goalie_stats_summary_simple(
if not sort_expr:
sort_expr = _goalie_stats_sorts(report=stats_type)

q_params["sort"] = urllib.parse.quote(json.dumps(sort_expr))
q_params["sort"] = json.dumps(sort_expr)

if not default_cayenne_exp:
default_cayenne_exp = f"gameTypeId={game_type_id} and seasonId<={end_season} and seasonId>={start_season}"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "nhl-api-py"
version = "2.12.2"
version = "2.12.3"
description = "NHL API (Updated for 2024/2025) and EDGE Stats. For standings, team stats, outcomes, player information. Contains each individual API endpoint as well as convience methods as well as pythonic query builder for more indepth EDGE stats."
authors = ["Corey Schaf <[email protected]>"]
readme = "README.md"
Expand Down
12 changes: 6 additions & 6 deletions tests/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def test_skater_stats_summary(h_m, nhl_client):
"limit": 70,
"start": 0,
"factCayenneExp": "gamesPlayed>=1",
"sort": "%5B%7B%22property%22%3A%20%22points%22%2C%20%22direction%22%3A%20%22DESC%22%7D%2C%20%7B%22"
"property%22%3A%20%22gamesPlayed%22%2C%20%22direction%22%3A%20%22ASC%22%7D%2C%20%7B%22property%22"
"%3A%20%22playerId%22%2C%20%22direction%22%3A%20%22ASC%22%7D%5D",
"sort": '[{"property": "points", "direction": "DESC"}, {"property": '
'"gamesPlayed", "direction": "ASC"}, {"property": "playerId", '
'"direction": "ASC"}]',
"cayenneExp": "gameTypeId=2 and seasonId<=20232024 and seasonId>=20232024",
}

Expand All @@ -98,9 +98,9 @@ def test_skater_stats_summary_franchise(h_m, nhl_client):
"limit": 70,
"start": 0,
"factCayenneExp": "gamesPlayed>=1",
"sort": "%5B%7B%22property%22%3A%20%22points%22%2C%20%22direction%22%3A%20%22DESC%22%7D%2C%20%7B%22"
"property%22%3A%20%22gamesPlayed%22%2C%20%22direction%22%3A%20%22ASC%22%7D%2C%20%7B%22property%22"
"%3A%20%22playerId%22%2C%20%22direction%22%3A%20%22ASC%22%7D%5D",
"sort": '[{"property": "points", "direction": "DESC"}, {"property": '
'"gamesPlayed", "direction": "ASC"}, {"property": "playerId", '
'"direction": "ASC"}]',
"cayenneExp": "franchiseId=19 and gameTypeId=2 and seasonId<=20232024 and seasonId>=20232024",
}

Expand Down

0 comments on commit db2f7ee

Please sign in to comment.