feat(baby): mvp

parent 29add5c8
import requests
from bs4 import BeautifulSoup
def main():
url_zebrina = "https://onlinebabyplants.com/shop/exclusive-alocasia-zebrina-variegated/"
url_poinsettia = "https://onlinebabyplants.com/shop/poinsettia/"
url_dragon = "https://onlinebabyplants.com/shop/alocasia-pink-dragon/"
for url in [url_zebrina,
url_poinsettia,
# url_dragon
]:
res = requests.get(url)
soup = BeautifulSoup(res.content, "html.parser")
name = soup.find(attrs={"class": "product_title"}).text
stock = soup.find(attrs={"class": "stock"}).text
print("%s: %s" % (name, stock))
if "Out of stock" not in stock:
sms("%s in stock 🎉 \"%s\"\n🔗 %s" % (name, stock, url))
def sms(msg: str):
print("Sending sms: \"%s\"" % msg)
res = requests.post("https://smsapi.free-mobile.fr/sendmsg",
json={"user": "23355840",
"pass": "1zdVdBEjjSqnv3",
"msg": msg})
if res.ok:
print("Success!")
else:
print(res.reason, res.headers, res.)
if __name__ == '__main__':
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment