Endpoints without parameters throwing Exception
When attempting to call an endpoint without any parameters, such as 'teams' or 'awards', it throws an error. I've noticed in the code that it always expects parameters, even if the endpoint doesn't require any.
Can you provide a code snippet to replicate this? @waner11
@BrayanMnz I think this is referring to calling statsapi.get() without only the endpoint parameter, e.g. statsapi.get("teams") rather than statsapi.get("teams", {}). The wrapper doesn't default the params to an empty dict, which I guess it could since not all endpoints require user-supplied parameters.
This is pedantic, but all endpoints do require at least one parameter (version)--the wrapper automatically adds it based on defaults in the endpoint definitions. The get function could still default to an empty dict.
Got it @toddrob99 , I will take a look on how this is built in the wrapper. If you have any input that could be helpful will be great
is anyone don't understand what this issue means, here is a snippet on how to replicate:
>>> import statsapi
>>> statsapi.get("teams")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: get() missing 1 required positional argument: 'params'
In the case of the teams endpoint, we need to pass an empty dict, in order for it to work.
>>> import statsapi
>>> statsapi.get("teams", {})
I apologize for late reply, but yes is what @toddrob99 explained, when calling the statsapi.get() without any parameters other than the endpoint name, was throwing an exception. Thanks for taking care of this!