ro  fr  en  es  pt  ar  zh  hi  de  ru
ART 2.0 ART 3.0 ART 4.0 ART 5.0 ART 6.0 Pinterest

Python:当特定产品出现在商店时,通过电子邮件通知我,具体取决于最低价格

On March 16, 2022, in Leadership Quantum-XX, by Neculai Fantanaru

您可以在此处查看完整代码:HTTPS://帕萨特斌.com/ND8E YT XA

安装Python.

我将作为一个例子乘坐网站HTTPS://呜呜呜.OK A自i.RO/

此外,作为本网站上的产品的示例,我会寻找这本书:“研究进展,颜色,组成和在牧师艺术中的表达”

The Python code will have to notify me by email when this book returns to stock, with a price of less than 90 RON.

提到:如果您希望在后台连续运行此代码,则需要更改文件扩展名.py。 .py。

在运行脚本之前,您需要执行以下操作:

  • From the CMD (command prompt) console, run the command:pip安装pythonw
To start the program run the following command in CMD (in the folder where the file is located):
  • pythonw okazii.pyw
Now the process will run continuously in the background. To stop the process, you must run the command:
  • TASKKILL /F /IM pythonw.exe
CAREFUL!!! All commands are run from the command line in the folder where the file is located.

如果要简单地使用Python运行该文件okazii.pyw。,你也可以这样做,但你应该始终保持控制台打开。 你可以用来停止执行Ctrl + C.来自命令提示符(CMD)

Do not use GMAIL for default email adress !

#-------------------------------------------------------------------------------
# Author:      Fantanaru Neculai
#
# Created:     16/03/2022
# Copyright:   (c) Fantanaru Neculai 2022
#-------------------------------------------------------------------------------

from bs4 import BeautifulSoup as bs
import pandas as pd
pd.set_option('display.max_colwidth', 500)
import time
import requests
import random
import re

page = requests.get("https://www.okazii.ro/")

soup = bs(page.content)

# Studiul desenului, culorii, compozitiei si expresiei in arta eclesiala
result = requests.get("https://www.okazii.ro/cautare/studiul+desenului%2C+culorii%2C+compozitiei+si+expresiei+in+arta+eclesiala.html")

# preluam text dintre  si 
produse_sectiune_pattern = re.compile('([\s\S]*?)
') produse_sectiune = re.findall(produse_sectiune_pattern, result.text) produse_sectiune = produse_sectiune[0] preturi_pattern = re.compile('(.*?)') preturi = re.findall(preturi_pattern, produse_sectiune) print(preturi) count = 0 for pret in preturi: if int(pret) < 90: # puneti <= daca vreti ca pretul sa fie si egal cu 90 RON count += 1 print("Am gasit {} oferte cu pretul sub 90 lei.".format(count)) # soup_cautare = bs(result.text, 'html.parser') # print(soup_cautare) #items = soup_cautare.find_all(class_ = 'listing-product ') #print(items) # Trimitere email import sys import smtplib from_addr = 'YOUR EMAIL ADRESS' to_addrs = ['YOUR EMAIL ADRESS'] msg = """From: Sender To: Recipient Subject: Okazii Am gasit 1 oferte cu pretul sub 90 lei. """ try: s = smtplib.SMTP('mail.neculaifantanaru.com', 26) # put here your own SMTP PORT and hosting email s.login('YOUR EMAIL ADRESS', 'PASSWORD') # do not use GMAIL !! s.sendmail(from_addr, to_addrs, msg) s.quit() except smtplib.SMTPException: print("Error: ", sys.exc_info()[0])

That's all folks.

If you like my code, then make me a favor: translate your website into Romanian, "ro".

此外,有一个版本2.这个代码或版本3.要么版本4.要么版本5.要么版本6.


Latest articles accessed by readers:

  1. An Eye To See And A Mind To Understand
  2. Turn Towards Me With An Eye Full Of Your Own Gaze
  3. The Snapshot Of Magic In God's Universe
  4. Rhythm Of My Heart

Donate via Paypal

Alternate Text

RECURRENT DONATION

Donate monthly to support
the NeculaiFantanaru.com project

SINGLE DONATION

Donate the desired amount to support
the NeculaiFantanaru.com project

Donate by Bank Transfer

Account Ron: RO34INGB0000999900448439

Open account at ING Bank

Join The Neculai Fantanaru Community



* Note: If you want to read all my articles in real time, please check the romanian version !

decoration
About | Site Map | Partners | Feedback | Terms & Conditions | Privacy | RSS Feeds
© Neculai Fântânaru - All rights reserved