toddrob99 / MLB-StatsAPI

Python wrapper for MLB Stats API
GNU General Public License v3.0
539 stars 100 forks source link

Awards winners by player/season #101

Closed jdominguez13 closed 1 year ago

jdominguez13 commented 1 year ago

Hey, I'm an inexperienced Python user trying to use this awesome tool, but can't seem to get the statsapi.get() call right. I'm trying to get awards won by a player (provided their personId) but can't seem to be able to pass the "recipients" parameter or the season parameter for that matter.

I started simple by trying to determine the 2022 ALROY award winner, but this code just provides me with metadata about the Award itself.

`params = { 'awardId':'ALROY', 'sportId':1, 'season':2022, 'recipients':'personId' }

awards = statsapi.get('awards', params)

awards`

Sorry for the dumb question, but Python is really not my strong suit.

Thanks,

Juan

toddrob99 commented 1 year ago

Pass True for the recipients parameter.

params = {
'awardId':'ALROY', 'sportId':1,
'season':2022,
'recipients':True
}

awards = statsapi.get('awards', params)

awards
jdominguez13 commented 1 year ago

Ah, my bad!

Thanks for the assist. I was able to get it now.

This is an awesome tool!