# HG changeset patch # User darius # Date 1188269930 0 # Node ID 275603a8e2aeade031542c6a9306f51614d95f35 # Parent e3f4ef0b6e390c67691fd07ed999d9e69851c18e Read config file from $HOME as well as CWD (use dotfile for $HOME) diff -r e3f4ef0b6e39 -r 275603a8e2ae scrape-vb.py --- a/scrape-vb.py Mon Aug 27 02:29:27 2007 +0000 +++ b/scrape-vb.py Tue Aug 28 02:58:50 2007 +0000 @@ -6,7 +6,7 @@ # Prints out (and emails) when criteria match based on cost, # destination, etc # -# $Id: scrape-vb.py,v 1.3 2007/08/27 02:29:27 darius Exp $ +# $Id: scrape-vb.py,v 1.4 2007/08/28 02:58:50 darius Exp $ ############################################################################ # # Copyright (C) 2007 Daniel O'Connor. All rights reserved. @@ -34,7 +34,7 @@ # ############################################################################ -import re, BeautifulSoup, datetime, time, smtplib, sys, urllib, ConfigParser +import os, re, BeautifulSoup, datetime, time, smtplib, sys, urllib, ConfigParser parsetitle = re.compile('([a-z ]+) - ([a-z ]+) \$([0-9]+)', re.IGNORECASE) parsetper = re.compile('Travel Period: ([0-9]+/[0-9]+/[0-9]+) - ([0-9]+/[0-9]+/[0-9]+)', re.IGNORECASE) @@ -43,7 +43,11 @@ conf.add_section('global') conf.set('global', 'mailsubj', 'Virgin Blue Happy Hour Deals') conf.set('global', 'vburl', 'http://virginblue.com.au') -conf.read('scrape-vb.ini') + +conflist = ['scrape-vb.ini'] +if ('HOME' in os.environ): + conflist.append(os.path.expanduser('~/.scrape-vb.ini')) +conf.read(conflist) try: #f = open("vb-happyhour.html")