define classes

This commit is contained in:
Andreas Zweili 2017-03-11 14:00:39 +01:00
parent c9dda6d0f9
commit f10bdb556b
1 changed files with 25 additions and 10 deletions

View File

@ -2,22 +2,37 @@
# get user email -> get url -> get price
#download website -> search for price -> compare price
#if price = website.price -> send mail(user.mail, url)
#
#
#
#
from lxml import html
import requests
class User():
email = input("Please enter your email address:")
class User(object):
def __init__ (self):
self.email = ""
def prompt_for_email(self):
self.email = input("Please enter your email address:")
class Website(object):
url = input("Please enter the url you want to monitor:")
page = requests.get(url)
tree = html.fromstring(page.content)
def __init__ (self):
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):
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:")