change script to a single run
This commit is contained in:
parent
22b9f7bcba
commit
147f1b599d
|
@ -104,17 +104,16 @@ class Configuration():
|
||||||
self.recipient_address = self.config['DEFAULT']['recipient_address']
|
self.recipient_address = self.config['DEFAULT']['recipient_address']
|
||||||
|
|
||||||
|
|
||||||
|
dryscrape.start_xvfb()
|
||||||
settings = Configuration()
|
settings = Configuration()
|
||||||
email = Email(settings.recipient_address)
|
email = Email(settings.recipient_address)
|
||||||
website = Website(settings.url)
|
website = Website(settings.url)
|
||||||
|
|
||||||
while True:
|
website.get_page()
|
||||||
website.get_page()
|
if website.extract_price() < settings.price:
|
||||||
if website.extract_price() < settings.price:
|
email.connecting(settings.smtp_server, settings.smtp_port)
|
||||||
email.connecting(settings.smtp_server, settings.smtp_port)
|
email.login(settings.sender_address, settings.password)
|
||||||
email.login(settings.sender_address, settings.password)
|
email.sending(settings.sender_address, settings.url)
|
||||||
email.sending(settings.sender_address, settings.url)
|
sys.exit(0)
|
||||||
sys.exit(0)
|
else:
|
||||||
print(datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
|
sys.exit(0)
|
||||||
print("No Match yet")
|
|
||||||
time.sleep(10)
|
|
||||||
|
|
|
@ -1,4 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
source bin/activate
|
# Get the current working directory
|
||||||
./price_checker.py
|
SCRIPTPATH=$(dirname -- "$(readlink -e -- "$BASH_SOURCE")")
|
||||||
|
|
||||||
|
# add the bin directory to the path
|
||||||
|
PATH=$PATH:$SCRIPTPATH/bin/
|
||||||
|
|
||||||
|
# activate the virtual environment
|
||||||
|
source $SCRIPTPATH/bin/activate
|
||||||
|
|
||||||
|
# execute the main script
|
||||||
|
python3 $SCRIPTPATH/price_checker.py
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Reference in New Issue