Skip to content

Commit 76ca6c8

Browse files
committed
added support to query for division using the division id
1 parent 78b2ae1 commit 76ca6c8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

statsapi/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,13 +1440,17 @@ def standings(
14401440

14411441

14421442
def standings_data(
1443+
14431444
leagueId="103,104",
14441445
division="all",
14451446
include_wildcard=True,
14461447
season=None,
14471448
standingsTypes=None,
14481449
date=None,
14491450
):
1451+
print("getting standings data")
1452+
print("division")
1453+
print(division)
14501454
"""Returns a dict of standings data for a given league/division and season."""
14511455
params = {"leagueId": leagueId}
14521456
if date:
@@ -1469,17 +1473,22 @@ def standings_data(
14691473
}
14701474
)
14711475

1476+
print(params)
14721477
r = get("standings", params)
14731478

14741479
divisions = {}
14751480

14761481
for y in r["records"]:
1482+
print(y["division"]["id"])
14771483
for x in (
14781484
x
14791485
for x in y["teamRecords"]
14801486
if division.lower() == "all"
14811487
or division.lower() == x["team"]["division"]["abbreviation"].lower()
1488+
or str(division) == str(x["team"]["division"]["id"])
1489+
14821490
):
1491+
print(x)
14831492
if x["team"]["division"]["id"] not in divisions.keys():
14841493
divisions.update(
14851494
{

0 commit comments

Comments
 (0)