toddrob99/MLB-StatsAPI

Determining a list of teams that a player played on

Dang1es opened this issue · 1 comments

Hello,
I am new to Python and I am having trouble determining how to find the teams that a player has played for.

Try something like this:

import statsapi
harper = statsapi.get("person", {"personId": 547180, "hydrate": "transactions"})["people"][0]
print(harper["transactions"])

The transactions should include all of the teams the player has played for. There might be other endpoints that include what you're looking for, but that's the first method that came to my mind.