install pip packages with requirements.txt

This commit is contained in:
Andreas Zweili 2017-03-13 11:15:54 +01:00
parent 3d96b3ae63
commit d74b082d82
2 changed files with 37 additions and 2 deletions

View File

@ -1,4 +1,4 @@
sudo apt-get install python3 python3-pip
python3 -m venv ../price_checker
source bin/activate
pip -r requirements.txt
pip install -r requirements.txt

View File

@ -3,9 +3,11 @@
#download website -> search for price -> compare price
#if price = website.price -> send mail(user.mail, url)
from lxml import html
from bs4 import BeautifulSoup
import requests
import time
import smtplib
import configparser
class User(object):
@ -46,6 +48,39 @@ class Price(object):
if not self.desired_price in current_price:
return False
class Configuration():
def check_location():
# setup the config parser
config = configparser.ConfigParser()
# check whether the config file exists either in the home folder or next to
# the binary
home = os.getenv('HOME')
config_file = "price_checker.cfg"
config_folder = ".config/price_checker/"
config_path = os.path.join(home, config_folder, config_file)
if os.path.isfile(config_path):
config.read(config_path)
elif os.path.isfile(config_file):
config.read(config_file)
else:
print("Configuration file not found.")
sys.exit(1)
# assign the repository variable depending whether it's a remote or a local
# repository
if 'server' in config['DEFAULT']:
repository = (config['DEFAULT']['user']
+ "@"
+ config['DEFAULT']['server']
+ ":"
+ config['DEFAULT']['repository_path'])
int_vars.server = config['DEFAULT']['server']
else:
repository = config['DEFAULT']['repository_path']
# assign the password variable
password = config['DEFAULT']['password']
# set the environment variables
os.environ['BORG_REPO'] = repository
os.environ['BORG_PASSPHRASE'] = password