Skip to content

Commit 2093203

Browse files
committed
code formatting with black
add debug logging for request_kwargs in get()
1 parent d9b1485 commit 2093203

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

statsapi/__init__.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,9 @@ def game_pace_data(season=datetime.now().year, sportId=1):
11221122
return r
11231123

11241124

1125-
def player_stats(personId, group="[hitting,pitching,fielding]", type="season", season=None):
1125+
def player_stats(
1126+
personId, group="[hitting,pitching,fielding]", type="season", season=None
1127+
):
11261128
"""Get current season or career stats for a given player."""
11271129
player = player_stat_data(personId, group, type, season)
11281130

@@ -1164,7 +1166,7 @@ def player_stat_data(
11641166
):
11651167
"""Returns a list of current season or career stat data for a given player."""
11661168

1167-
if season is not None and 'season' not in type:
1169+
if season is not None and "season" not in type:
11681170
raise ValueError(
11691171
"The 'season' parameter is only valid when using the 'season' type."
11701172
)
@@ -1224,10 +1226,7 @@ def latest_season(sportId=1):
12241226
(
12251227
s
12261228
for s in all_seasons.get("seasons", [])
1227-
if (
1228-
datetime.today().strftime("%Y-%m-%d")
1229-
< s.get("seasonEndDate", "")
1230-
)
1229+
if (datetime.today().strftime("%Y-%m-%d") < s.get("seasonEndDate", ""))
12311230
),
12321231
all_seasons["seasons"][-1],
12331232
)
@@ -1777,6 +1776,11 @@ def get(endpoint, params={}, force=False, *, request_kwargs={}):
17771776
+ note
17781777
)
17791778

1779+
if len(request_kwargs):
1780+
logger.debug(
1781+
"Including request_kwargs in requests.get call: {}".format(request_kwargs)
1782+
)
1783+
17801784
# Make the request
17811785
r = requests.get(url, **request_kwargs)
17821786
if r.status_code not in [200, 201]:

0 commit comments

Comments
 (0)