Produktverfügbarkeit checken mit Python
Aktuell warte ich auf die Verfügbarkeit eines bestimmten Werkzeugs bei einem Online-Händler. Das geht auch gut mit Python 🙂
Man könnte das noch weiter automatisieren und beispielsweise eine E-Mail verschicken, wenn sich der Status ändert.
import requests from bs4 import BeautifulSoup headers = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET', 'Access-Control-Allow-Headers': 'Content-Type', 'Access-Control-Max-Age': '3600', 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0' } url = "https://www.somecoolstore.de/de_DE/EUR/someproductpage" req = requests.get(url, headers) soup = BeautifulSoup(req.content, 'html.parser') a=mydivs = soup.find("span", {"class": "padlr0-xsl"}) print(a.text) input('Push any key') |