Allison Tharp has an update to her NFL Alerts Python script:
Next, I wanted to make the alerts be a little more meaningful. The alert for a scoring play was already pretty good – it sends something like: BUF – Q4 – TD – J.Boykin 4 yd. pass from C.Jones (pass failed) Drive: 8 plays, 83 yards in 1:08 IND (19) at BUF (18). This is good, and in fact it is what I want the rest of the alerts to look like. However, I’d like the subject of the email to have the name of the team that scored (before it was just ‘Scoring Play’).
To do that, I needed to find out how to get the name of the scoring team. This was a little tricky because the documentation for the nflgame library, though pretty good, doesn’t give a good indication on how to find this.
Read on for more details, including specifics on turnovers and penalties.