changeset 5:275603a8e2ae

Read config file from $HOME as well as CWD (use dotfile for $HOME)
author darius
date Tue, 28 Aug 2007 02:58:50 +0000
parents e3f4ef0b6e39
children 9f3eb9a07966
files scrape-vb.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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")