Skip to content

Instantly share code, notes, and snippets.

@mtellin
Last active December 16, 2020 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtellin/54d6bdfeb4596360305828dcf0226ab0 to your computer and use it in GitHub Desktop.
Save mtellin/54d6bdfeb4596360305828dcf0226ab0 to your computer and use it in GitHub Desktop.
My most pathetic script yet. Checks local Culver's for the Flavor of the Day ice cream and sends a message to Slack when it is Bonfire S'mores.
#!/usr/bin/env python3
# Script to check Culver's and alert when it's bonfire smores
import requests
import os
from bs4 import BeautifulSoup
# Set environment variables for the following items
slackToken = os.environ['SLACK_TOKEN']
culversLogo = os.environ['CULVERS_LOGO']
city = os.environ['CULVERS_CITY']
# Pull the local Culver's page and use BeautifulSoup to parse
page = requests.get(f'https://www.culvers.com/restaurants/{city}')
soup = BeautifulSoup(page.text, 'html.parser')
fotdSection = soup.find("div", {"class": "ModuleRestaurantDetail-fotd"})
fotdString = fotdSection.text
fotd = fotdString.split('Day: ')[1]
# Using rstrip to remove the extra line break so I can compare the strings
if fotd.rstrip() == 'Bonfire S\'mores':
slackData = {
'channel': '#general',
'text': 'The flavor of the day is Bonfire S\'mores',
'username': 'culvers',
'icon_url': culversLogo,
'token': slackToken
}
response = requests.post('https://slack.com/api/chat.postMessage', slackData)
@pepopowitz
Copy link

Hi friend, I was curious if Culver's had an API for flavors of the day and found this -- I just want to let you know that there is nothing pathetic about this script. 🍨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment