Mercurial > ~darius > hgwebdir.cgi > scrape-vb
comparison scrape-vb.py @ 4:e3f4ef0b6e39
Oops, read URL from configuration like I planned.
author | darius |
---|---|
date | Mon, 27 Aug 2007 02:29:27 +0000 |
parents | 89232ea0c3d4 |
children | 275603a8e2ae |
comparison
equal
deleted
inserted
replaced
3:89232ea0c3d4 | 4:e3f4ef0b6e39 |
---|---|
4 # Screen scraper for Virgin Blue to look for happy hour deals | 4 # Screen scraper for Virgin Blue to look for happy hour deals |
5 # | 5 # |
6 # Prints out (and emails) when criteria match based on cost, | 6 # Prints out (and emails) when criteria match based on cost, |
7 # destination, etc | 7 # destination, etc |
8 # | 8 # |
9 # $Id: scrape-vb.py,v 1.2 2007/08/27 01:42:11 darius Exp $ | 9 # $Id: scrape-vb.py,v 1.3 2007/08/27 02:29:27 darius Exp $ |
10 ############################################################################ | 10 ############################################################################ |
11 # | 11 # |
12 # Copyright (C) 2007 Daniel O'Connor. All rights reserved. | 12 # Copyright (C) 2007 Daniel O'Connor. All rights reserved. |
13 # | 13 # |
14 # Redistribution and use in source and binary forms, with or without | 14 # Redistribution and use in source and binary forms, with or without |
45 conf.set('global', 'vburl', 'http://virginblue.com.au') | 45 conf.set('global', 'vburl', 'http://virginblue.com.au') |
46 conf.read('scrape-vb.ini') | 46 conf.read('scrape-vb.ini') |
47 | 47 |
48 try: | 48 try: |
49 #f = open("vb-happyhour.html") | 49 #f = open("vb-happyhour.html") |
50 f = urllib.urlopen(vburl) | 50 f = urllib.urlopen(conf.get('global', 'vburl')) |
51 except IOError, e: | 51 except IOError, e: |
52 print "Unable to fetch page - " + str(e) | 52 print "Unable to fetch page - " + str(e) |
53 sys.exit(1) | 53 sys.exit(1) |
54 | 54 |
55 s = BeautifulSoup.BeautifulSoup(f) | 55 s = BeautifulSoup.BeautifulSoup(f) |