py-mlb: Python library for MLB.com “API”
30 October 2009 4:17 pm
So in a follow-up to an earlier post regarding MLB.com’s unofficial, undocumented, kind-of, sort-of API, I’ve written a Python abstraction layer for the league, the teams, and the players. Like everything it’s beta, or maybe alpha, and anything it does to your system is likely your own doing.
That being said I’m rather happy with the first iteration, but there are some design issues to iron out and lots of to-dos. I wanted to throw out it out there to the community so that A) it can be used, B) my Python skills and design ideas can be harshly criticized (only partially kidding here, I love to hear feedback), and C) anyone who wants to can work on the code as well.
As an example, here’s how one might get the entire roster for the Seattle Mariners:
from py_mlb import player, team, league l = league.League() team = l.teams['sea'] team.fetchRoster() for player_id, player in team.roster.iteritems(): print player.name_full
I’ll setup a permanent page for the project in a bit. For now, the project is hosted here at GitHub. ¶
Leave a comment