import requests
from bs4 import BeautifulSoup
import time
from fake_useragent import UserAgent
ua = UserAgent()
while True:
try:
#create headers
headers = {'User-Agent': ua.random}
time.sleep(0)
# Download the website's HTML
response = requests.get("https://shop.flipperzero.one/", headers=headers)
response.raise_for_status()
html = response.text
# Use BeautifulSoup to parse the HTML
soup = BeautifulSoup(html, 'html.parser')
# Check for the presence of "SOLD OUT"
if soup.find("span", text="Sold out"):
print("SOLD OUT still appears on the website.")
else:
print("SOLD OUT no longer appears on the website!")
except requests.exceptions.RequestException as e:
# handle error
print(f'Error: {e}')
except Exception as e:
# handle other errors
print(f'Error: {e}')
finally:
# Sleep for 1 hour
time.sleep(60*60)