Skip to content

Instantly share code, notes, and snippets.

@an-empty-string
Created July 27, 2023 15:52
Show Gist options
  • Save an-empty-string/b4adb8631510d452ad949dc2d0bcf08c to your computer and use it in GitHub Desktop.
Save an-empty-string/b4adb8631510d452ad949dc2d0bcf08c to your computer and use it in GitHub Desktop.
# visit https://www.mlb.com/redsox/schedule/downloadable-schedule to get new schedule
URL = "https://www.ticketing-client.com/ticketing-client/csv/GameTicketPromotionPrice.tiksrv?team_id=111&home_team_id=111&display_in=singlegame&ticket_category=Tickets&site_section=Default%E2%8A%82category=Default&leave_empty_games=true&event_type=T&year=2023&begin_date=20230201"
LOCATION = "Fenway Park"
PUSHOVER_KEY = "(pushover API key)"
PUSHOVER_USER = "(pushover user key)"
import csv
import arrow
import requests
for row in csv.DictReader(requests.get(URL).text.split("\n")):
if arrow.get(row["START DATE"], "MM/DD/YY").date() == arrow.get().date():
break
else:
exit(0)
requests.post(
"https://api.pushover.net/1/messages.json",
data={
"token": PUSHOVER_KEY,
"user": PUSHOVER_USER,
"title": "Fenway game today",
"message": f"{row['SUBJECT']}: {row['START TIME ET']} to {row['END TIME ET']}",
},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment