First pass at Pirates

This commit is contained in:
2026-05-24 23:42:36 +00:00
parent 52cb4a4b46
commit 897f41da72
5 changed files with 37 additions and 30 deletions

29
mlb.py Normal file
View File

@@ -0,0 +1,29 @@
import statsapi
import datetime
def get_pirates():
results = ""
todaystr = datetime.datetime.now().strftime("%Y-%m-%d")
tomorrow = datetime.datetime.now()+datetime.timedelta(days=1)
tomorrowstr = tomorrow.strftime("%Y-%m-%d")
piratesid = statsapi.lookup_team('pittsburgh')[0]['id']
todaysgame = statsapi.schedule(team=piratesid,date=todaystr)
if todaysgame:
results += todaysgame[0]["summary"]+" "+todaysgame[0]["game_datetime"]+"\n"
tomorrowsgame = statsapi.schedule(team=piratesid,date=tomorrowstr)
if tomorrowsgame:
dtt = tomorrowsgame[0]["game_datetime"][11:16]
results+= tomorrowsgame[0]["summary"]+" "+tomorrowsgame[0]["game_datetime"]+"\n"
return results
if __name__ == '__main__':
print(get_pirates())
#print(statsapi.schedule(team=piratesid))
# 6/5 Local time 7:15 pm '2026-06-05T23:15:00Z'
# 6/6 Local time 4:10 pm '2026-06-06T20:10:00Z'
# 6/7 Local time 1:35 pm '2026-06-07T17:35:00Z'
# datetime.datetime.strptime(game[0]["game_datetime"],"%Y-%m-%dT%H:%M:%SZ")
# gamedateutc = gamedate.replace(tzinfo=datetime.timezone.utc)
# gamedateutc.astimezone()