Created
October 24, 2019 04:22
-
-
Save leah/7dfcc25383f8a095ba700c5c9883a680 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def check_changes(): | |
# HTML from website | |
req = requests.get('https://grossdomesticproduct.com') | |
web_text = req.text | |
# Saved HTML | |
try: | |
file = open('grossdomesticproduct.html') | |
file_text = file.read() | |
file.close() | |
except FileNotFoundError: | |
file_text = '' # file doesn't exist yet, no problem | |
if web_text != file_text: | |
# Update file with changes | |
file = open('grossdomesticproduct.html','w+') | |
file.write(web_text) | |
file.close() | |
return True, 'BANKSY! ✨ grossdomesticproduct.com has changed!' | |
return False, 'No changes to grossdomesticproduct.com. 😪' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment