Closed toddrob99 closed 4 years ago
The awards and draft endpoints have path parameters with leading slashes, and the leading slash endpoint configuration setting is not being honored. This results in 404 errors when attempting to use these endpoints.
>>> statsapi.get('awards',{'awardId':'NLMVP'}) 2019-11-05 21:04:24,561 - DEBUG - statsapi(10988) - URL: https://statsapi.mlb.com/api/{ver}/awards{awardId}{recipients} 2019-11-05 21:04:24,564 - DEBUG - statsapi(10988) - Found path param: awardId 2019-11-05 21:04:24,564 - DEBUG - statsapi(10988) - path_params: {'awardId': 'NLMVP'} 2019-11-05 21:04:24,565 - DEBUG - statsapi(10988) - query_params: {} 2019-11-05 21:04:24,565 - DEBUG - statsapi(10988) - Replacing {awardId} 2019-11-05 21:04:24,565 - DEBUG - statsapi(10988) - URL: https://statsapi.mlb.com/api/{ver}/awardsNLMVP{recipients} 2019-11-05 21:04:24,566 - DEBUG - statsapi(10988) - Replacing {ver} with default: v1. 2019-11-05 21:04:24,566 - DEBUG - statsapi(10988) - URL: https://statsapi.mlb.com/api/v1/awardsNLMVP{recipients} 2019-11-05 21:04:24,566 - DEBUG - statsapi(10988) - Removing optional param {recipients} 2019-11-05 21:04:24,567 - DEBUG - statsapi(10988) - URL: https://statsapi.mlb.com/api/v1/awardsNLMVP Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python37\lib\site-packages\statsapi\__init__.py", line 2453, in get raise ValueError("Request failed. Status Code: " + str(r.status_code) + ".") ValueError: Request failed. Status Code: 404.
>>> statsapi.get('draft',{}) 2019-11-05 21:05:57,121 - DEBUG - statsapi(10988) - URL: https://statsapi.mlb.com/api/{ver}/draft{prospects}{year}{latest} 2019-11-05 21:05:57,121 - DEBUG - statsapi(10988) - path_params: {} 2019-11-05 21:05:57,122 - DEBUG - statsapi(10988) - query_params: {} 2019-11-05 21:05:57,122 - DEBUG - statsapi(10988) - Replacing {ver} with default: v1. 2019-11-05 21:05:57,153 - DEBUG - statsapi(10988) - URL: https://statsapi.mlb.com/api/v1/draft{prospects}{year}{latest} 2019-11-05 21:05:57,153 - DEBUG - statsapi(10988) - Removing optional param {prospects} 2019-11-05 21:05:57,153 - DEBUG - statsapi(10988) - URL: https://statsapi.mlb.com/api/v1/draft{year}{latest} 2019-11-05 21:05:57,185 - DEBUG - statsapi(10988) - Replacing {year} with default: 2019. 2019-11-05 21:05:57,252 - DEBUG - statsapi(10988) - URL: https://statsapi.mlb.com/api/v1/draft2019{latest} 2019-11-05 21:05:57,253 - DEBUG - statsapi(10988) - Removing optional param {latest} 2019-11-05 21:05:57,253 - DEBUG - statsapi(10988) - URL: https://statsapi.mlb.com/api/v1/draft2019 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python37\lib\site-packages\statsapi\__init__.py", line 2453, in get raise ValueError("Request failed. Status Code: " + str(r.status_code) + ".") ValueError: Request failed. Status Code: 404.
Addressed in v0.1.5
The awards and draft endpoints have path parameters with leading slashes, and the leading slash endpoint configuration setting is not being honored. This results in 404 errors when attempting to use these endpoints.