Generation

generate functionFri, 07 Apr 2023

quiero un bot que compruebe cada 5 minutos si hay stock de este producto https://www.adidas.com.ar/camiseta-titular-argentina-3-estrellas-2022/IB3593.html tambien necesito que me lo mande a un bot telegram

import requests from bs4 import BeautifulSoup import telepot from telepot.loop import MessageLoop def on_chat_message(msg): content_type, chat_type, chat_id = telepot.glance(msg) print(content_type, chat_type, chat_id) if content_type == 'text': bot.sendMessage(chat_id, msg['text']) def get_stock(url): 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") main_container = soup.find(class_="product-details__main-container") name = main_container.find(class_="product-details__name") size_container

Questions about programming?Chat with your personal AI assistant