Skip to content

Commit 4aeee67

Browse files
committed
fix: draft url missing slash #126
fix: default draft to current year #126
1 parent b67ef0a commit 4aeee67

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

statsapi/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1691,7 +1691,10 @@ def get(endpoint, params, force=False):
16911691
% (param, ep["path_params"][param]["default"])
16921692
)
16931693
url = url.replace(
1694-
"{" + param + "}", ep["path_params"][param]["default"]
1694+
"{" + param + "}",
1695+
("/" if ep["path_params"][param]["leading_slash"] else "")
1696+
+ ep["path_params"][param]["default"]
1697+
+ ("/" if ep["path_params"][param]["trailing_slash"] else ""),
16951698
)
16961699
else:
16971700
if force:

statsapi/endpoints.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@
106106
},
107107
"year": {
108108
"type": "str",
109-
"default": "2019", # TODO: current year or most recent draft year
109+
"default": "",
110110
"leading_slash": True,
111111
"trailing_slash": False,
112-
"required": True,
112+
"required": False,
113113
},
114114
"latest": {
115115
"type": "bool",

0 commit comments

Comments
 (0)