Tweaking, including reducing sig figs in weather
This commit is contained in:
9
mlb.py
9
mlb.py
@@ -21,8 +21,10 @@ def process_game(game,mytz):
|
||||
else: # game in progress
|
||||
if score_pirates > score_other:
|
||||
results += ", Pirates winning"
|
||||
else:
|
||||
elif score_pirates < score_other:
|
||||
results += ", Pirates losing"
|
||||
else:
|
||||
results += ", tied"
|
||||
results += " "+str(game["away_score"])+" - "+str(game["home_score"])
|
||||
if game["status"] != "Final":
|
||||
gamedate = datetime.datetime.strptime(game["game_datetime"],"%Y-%m-%dT%H:%M:%SZ")
|
||||
@@ -45,7 +47,12 @@ def get_pirates():
|
||||
todaystr = datetime.datetime.now(tz=useastern_timezone).strftime("%Y-%m-%d")
|
||||
tomorrow = datetime.datetime.now(tz=useastern_timezone)+datetime.timedelta(days=1)
|
||||
tomorrowstr = tomorrow.strftime("%Y-%m-%d")
|
||||
yesterday = datetime.datetime.now(tz=useastern_timezone)+datetime.timedelta(days=-1)
|
||||
yesterdaystr = yesterday.strftime("%Y-%m-%d")
|
||||
piratesid = statsapi.lookup_team('pittsburgh')[0]['id']
|
||||
yesterdaysgame = statsapi.schedule(team=piratesid,date=yesterdaystr)
|
||||
if yesterdaysgame:
|
||||
results+= "Yesterday: "+process_game(yesterdaysgame[0],useastern_timezone)+"\n"
|
||||
todaysgame = statsapi.schedule(team=piratesid,date=todaystr)
|
||||
if todaysgame:
|
||||
results+= "Today: "+process_game(todaysgame[0],useastern_timezone)+"\n"
|
||||
|
||||
Reference in New Issue
Block a user