-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
49 lines (41 loc) · 1.21 KB
/
server.py
File metadata and controls
49 lines (41 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import time
import sys
sys.path.insert(0, './database')
import connection
from _init_ import getDriver
import testGettingProce as prices
import emailsend
import pymysql
running = True
driver = getDriver()
while running:
db = pymysql.connect(
host='us-cdbr-east-02.cleardb.com',
user='bc9047f246620c',
password='fec4305d',
db='heroku_bd0b73b73c741f0')
cr = db.cursor()
alldata = connection.getRowsFromItem1(cr)
for data in alldata:
try:
link = data[1]
name = data[2]
oldPrice = float(data[3])
email = data[4]
driver.get(link)
price = prices.getPrice(driver)
print(name)
print(oldPrice)
print(price)
print(link)
if price < oldPrice:
#in here can you change the price in data base to be the value of "price"
connection.UpdatePrice(link, price)
print("rebate")
try:
emailsend.sendemail(email, oldPrice, price, name, link)
except:
print("error")
except:
print("error")
time.sleep(60)