DECROMAX

Untitled

Jan 4th, 2022
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. # also import email.errors
  2.  
  3. url = 'https://www.jbhifi.com.au/products/ultimate-ears-boom-3-portable-bluetooth-speaker-night-black'
  4.  
  5. try:
  6.     res = requests.get(url)
  7.     res.raise_for_status()
  8.  
  9. except requests.exceptions.HTTPError as err:
  10.     raise SystemExit(err)
  11.  
  12. soup = BeautifulSoup(res.text, 'html.parser')
  13.  
  14. mySpan = float(soup.find("span", class_="price").text.replace("$", ""))
  15.  
  16. try:
  17.     if mySpan <= 180:
  18.         sendEmail()
  19.  
  20.     else:
  21.         print("Price is high")
  22.  
  23. except MessageError as e:
  24.     print(f"Email not sent: {e}")
Advertisement
Add Comment
Please, Sign In to add comment