Last active
March 27, 2021 18:13
-
-
Save mettamatt/54244038a37e5a8ce1872ce7bc3dc685 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
import requests | |
from bs4 import BeautifulSoup | |
import time | |
import webbrowser | |
# while this is true (it is true by default), | |
while True: | |
url = "https://www.vaccinateri.org/client/registration?clinic_id=1534" | |
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'} | |
response = requests.get(url, headers=headers) | |
soup = BeautifulSoup(response.text, "html.parser") | |
try: | |
text = soup.find(class_="danger-alert").get_text() | |
except: | |
text = "" | |
if text == 'Clinic does not have any appointment slots available.': | |
time.sleep(3) | |
# continue with the script, | |
continue | |
else: | |
print('Match found') | |
print (url) | |
webbrowser.open(url) | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment