define classes
This commit is contained in:
parent
c9dda6d0f9
commit
f10bdb556b
|
@ -2,22 +2,37 @@
|
||||||
# get user email -> get url -> get price
|
# get user email -> get url -> get price
|
||||||
#download website -> search for price -> compare price
|
#download website -> search for price -> compare price
|
||||||
#if price = website.price -> send mail(user.mail, url)
|
#if price = website.price -> send mail(user.mail, url)
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
from lxml import html
|
from lxml import html
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
class User():
|
class User(object):
|
||||||
email = input("Please enter your email address:")
|
|
||||||
|
def __init__ (self):
|
||||||
|
self.email = ""
|
||||||
|
|
||||||
|
def prompt_for_email(self):
|
||||||
|
self.email = input("Please enter your email address:")
|
||||||
|
|
||||||
class Website(object):
|
class Website(object):
|
||||||
url = input("Please enter the url you want to monitor:")
|
|
||||||
page = requests.get(url)
|
def __init__ (self):
|
||||||
tree = html.fromstring(page.content)
|
self.url = ""
|
||||||
|
|
||||||
|
def prompt_for_url(self):
|
||||||
|
url = input("Please enter the url you want to monitor:")
|
||||||
|
|
||||||
|
def get_page(self, url):
|
||||||
|
page = requests.get(url)
|
||||||
|
tree = html.fromstring(page.content)
|
||||||
|
return self.tree
|
||||||
|
|
||||||
|
|
||||||
class Price(object):
|
class Price(object):
|
||||||
desired_price = input("Please enter the price you're looking for:")
|
|
||||||
|
def __init__ (self):
|
||||||
|
self.desired_price = ""
|
||||||
|
|
||||||
|
def prompt_for_price(self):
|
||||||
|
desired_price = input("Please enter the price
|
||||||
|
you're looking for:")
|
||||||
|
|
Reference in New Issue