Created
July 27, 2023 15:52
-
-
Save an-empty-string/b4adb8631510d452ad949dc2d0bcf08c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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