Last active
June 9, 2016 18:02
-
-
Save qolop/5c095708c57f420dfbae8c3a27f831ac to your computer and use it in GitHub Desktop.
update link formatting
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
# opens today's South Portland High School announcements in terminal/command prompt | |
import time | |
from bs4 import BeautifulSoup as clam_chowder | |
from urllib.request import urlopen | |
def main(): | |
dt1 = time.strftime("%Y/%m/%d") | |
dt2 = time.strftime("%B-%-d-%Y") | |
url = "http://highschool.spsd.org/riots/{}/{}/".format(dt1, dt2).lower() | |
print(url) | |
full_page = urlopen("{}".format(url)).read() | |
announcement = str(clam_chowder(full_page, "lxml").article.get_text()) | |
print("{}".format(announcement)) | |
if __name__ == "__main__": | |
if time.strftime("%A") == "Saturday" or time.strftime("%A") == "Sunday": | |
print("There's no school today. It's the weekend.") | |
quit() | |
else: | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment